|
MKC002 wrote: how to use system API for given time
What exactly do you mean by this; which API and what time?
MKC002 wrote: some times a when i call system api, my computer hangs and i need to reboot
Perhaps if you show an extract of the code that does this we may be able to help.
MKC002 wrote: can i use for given time
Use what and for what time - time of day, time interval, ...?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
our server maintains large amount of data. Everyday new files/folders created on it. A serevice set some special properties for files/folders. One service checkes if some property does not exist in file/folder then move the file to another location for further processing.
Here one service call GetFileAttributes and GetVolumeInformation for disk where file will be move. From this function we get volume label and other information to store in database. Sometimes system hangs and i need to reboot. I noticed system hangs due to GetVolumeInformation.
So, can i set time limit for this function. If after given time i dont get volume label then move the file to another disk.
|
|
|
|
|
It's more important to discover why the system hangs on this function; perhaps it is trying to access a network disk and you are having network problems, or the drive is failing. You could also move this code into a background thread and then kill it after a fixed time interval from your main thread.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thanks for your reply. To play with thread is little difficult.
Please give any link to kill thread which is safe and does not result in any type of crash.
|
|
|
|
|
MKC002 wrote: Please give any link to kill thread which is safe and does not result in any type of crash.
You do realise what you are asking! How can I possibly know what code could be added to your program that will not crash it, even if I could be bothered to go and look for such a link? You are the developer it's up to you to do the work.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi Guys,
I am trying to find status of may contacts but not able to find appropriate function
here is the sample for that
#include <windows.h>
#include <tchar.h>
#include "c:\program files\Microsoft Office Communicator\SDK\msgrua.h"
const GUID IID_IMessenger =
{0xD50C3186,0x0F89,0x48f8,{0xB2,0x04,0x36,0x04,0x62,0x9D,0xEE,0x10}};
const GUID CLSID_Messenger =
{0x8885370D,0xB33E,0x44b7,{0x87,0x5D,0x28,0xE4,0x03,0xCF,0x92,0x70}};
const GUID IID_MessengerContacts =
{0xE7479A0F,0xBB19,0x44a5,{0x96,0x8F,0x6F,0x41,0xD9,0x3E,0xE0,0xBC}};
IMessenger* m_pIMessenger;
int _tmain(int argc, _TCHAR* argv[])
{
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
HRESULT hr = CoCreateInstance(CLSID_Messenger,NULL,CLSCTX_LOCAL_SERVER,
IID_IMessenger, (LPVOID *)&m_pIMessenger);
BSTR myName;
MISTATUS sMyStatus;
hr = m_pIMessenger->get_MyFriendlyName(&myName);
hr = m_pIMessenger->get_MyStatus(&sMyStatus);
BSTR serviceId;
m_pIMessenger->get_MyServiceId(&serviceId);
IDispatch *pContacts;
IMessengerContacts *pCon;
m_pIMessenger->get_MyContacts(&pContacts);
pContacts->QueryInterface(__uuidof(IMessengerContacts),(void**)&pCon);
IDispatch *pDispatch;
hr=pCon->Item(1,&pDispatch);
long lCount=0;
pCon->get_Count(&lCount);
CoUninitialize();
return 0;
}
Please help me in finding appropriate function to get information about each contact.
vikas da
|
|
|
|
|
Hi all,
I have made a dialog based application and my application is closing if i press ctrl+scrolllock.
I want to disable this action in my application.
Thanks in advance
|
|
|
|
|
Use PreTranslateMessage to intercept the CTRL+SCROLLLOCK key. Add the function to the dialog using the class wizard.
BOOL myDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
if( GetKeyState( VK_CONTROL )
{
if( pMsg->wParam == VK_SCROLL) ) { return TRUE; }
}
}
return CDialog::PreTranslateMessage(pMsg);
}
More [here]
|
|
|
|
|
Start with a blank dialog application. Run it and press the Ctrl+ScrLck keys. Does anything happen?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 1-Dec-11 9:22am.
|
|
|
|
|
yes it closes the dialog box
|
|
|
|
|
I got TopCoder23's suggestion to work by changing VK_SCROLL to VK_CANCEL in that last if statement. I'm unsure of why, however.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi all,
I have make a three views in a child frame using split window. But I'm unable to re size them. How can I do that. Also those views are appeared when I click on the view. Why is that ?
Thanks.
|
|
|
|
|
With that much information it's impossible to guess what's happening in your code. Show some of the code that fails and explain what it is supposed to be doing.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Invoke a Call to the function CSplitterWnd::SetColumnInfo to set the specified column size.
Invoke a Call to the function CSplitterWnd::SetRowInfo to set the specified row size.
Invoke a Call to the function CSplitterWnd::RecalcLayout redisplay the splitter window after adjusting row or column size.
MSDN docs: [CSplitterWnd::SetColumnInfo] and [CSplitterWnd::SetRowInfo] and [CSplitterWnd::RecalcLayout].
Sample code:
void CMyFrame::OnSize(UINT nType, int cx, int cy)
{
if(::IsWindow(m_wndSplitter.m_hWnd) && ::IsWindow(m_wndSplitter2.m_hWnd))
{
m_wndSplitter.SetRowInfo(0, cy*2/3, 10);
m_wndSplitter.SetRowInfo(1, cy/3, 10);
m_wndSplitter2.SetColumnInfo(0, cx/4, 10);
m_wndSplitter2.SetColumnInfo(1, cx*3/4, 10);
RecalcLayout();
}
}
|
|
|
|
|
In VB, I used string.contains to see if a value exist in a string, Is there a c++ equivalent?
I looked at find, replace, but wasn't sure about them, or I don't know what the nomenclature is for it.
I want to make sure that a WCHAR doesn't contain the value before I wcsncat_s it.
modified 28-Nov-11 13:13pm.
|
|
|
|
|
yes, find is what you want.
str.find("target");
or
str.find("target", startPos);
|
|
|
|
|
Is that for string?, I forget to mention I was working with unicode characters (WCHAR)
I'll give it a try right now, Thanks Chris.
|
|
|
|
|
jkirkerx wrote: Is that for string?
for std::string and std::wstring, yes.
|
|
|
|
|
I got lucky, and used wcsncpy_s, as nomenclature, that lead me to a very long list of functions in MSDN, and I found wcsstr. It was buried so deep, and the description was very vague.
So I wrote it, and so far so good, no double entries anymore. That was a hard one, Eric scared me off with having to use pointers, and I could not find anything on the subject.
Thanks Chris and Eric for the Help.
pzMatch = _tcsstr(szNewServerNames, szAddServerName);
int iMatch = (int)(pzMatch -szNewServerNames + 1);
if (pzMatch = NULL) {
_tcsncat_s(szNewServerNames, iSNs, szAddServerName, iASN );
}
|
|
|
|
|
Use the CString class in C++. Yes, you can use in in Win32 if you include the header and lib.
If not, noy need to write raw C style code, searching an array for a pattern drectly. And as a VB coder, you are going to hit poiters big time, be prepared, its gnarly.
==============================
Nothing to say.
|
|
|
|
|
Richard got me using WCHAR's, and Ihaven't made it over the pointer mountain yet. I still have a code module to work on from Richard that works with pointers.
Let me try the find first, it's a registry function and I want to stick with the same format.
Thanks!
|
|
|
|
|
jkirkerx wrote: Ihaven't made it over the pointer mountain yet.
Worth persevering, pointers are very very usefull. When you write C, you really are aware of writing real code, and I dont mean that in an elitist way, just that you are directly manipulating the machine. Well, OK assembler is more direct, but C is as close, without having to tell it how to eat and breathe.
==============================
Nothing to say.
|
|
|
|
|
I must concur that message.
Writing my program is getting depressing. Now I'm doing the SQL stuff, and opened a whole new can of worms to eat for another week.
I'll get to the pointers soon, but this was a quick patch for my registry program until I figure out the pointers and use the code that Richard wrote for me, so I can implement it.
|
|
|
|
|
Hi Experts.
I had created a system driver, which is successfully installed in x86 system. But when i try to install in x64 it gives error, Unsigned Driver Installation Unsupported
Is there any logical work around so that unsigned driver can be installed in x64 system.
I am a individual developer, so i am unable to get code signing certificate.
please guide..
Regards,
Vishal
modified 3-Dec-11 13:01pm.
|
|
|
|
|
You can test sign a driver during development.
You can use some tools that come along with the WDK to do this.
Basically you first create a test certificate using MakeCert.exe .
You then install the certificate using CertMgr.exe .
Then sign the driver binaries using SignTool.exe .
The above method is use to sign the driver binaries.
You can also use Inf2Cat.exe to create a CAT file if your driver has an INF based package.
Another important step is that you must first put the system into Test Mode to install test signed drivers.
This applies to both steps mentioned above.
You can do this by executing the command bcdedit -set testsigning on from an elevated command prompt.
More information here - Signing Drivers during Development and Test (Windows Vista and Later)[^]
|
|
|
|
|