Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to resolve Waitformultipleobjects returning -1?
Posted
Comments
Sergey Alexandrovich Kryukov 3-Mar-11 2:21am    
Why didn't you read the help on this API as I suggested?
--SA

1 solution

Check out the return codes secion of MSDN[^].

WAIT_FAILED (0xFFFFFFFF) The function has failed. To get extended error information, call GetLastError.
Edit: To clarify, 0xFFFFFFFF == -1. Search google for signed/unsigned conversions if you don't know why.

If you go on to read GetLastError[^] you will come across something like this, which prints to the console the error code and associated message from the pages at http://msdn.microsoft.com/en-us/library/ms681381(v=vs.85).aspx[^]
LPSTR szMessage;
DWORD nErr = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, nErr , MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&szMessage, 0, NULL);
printf("Error 0x%08X (%u): %s\n", nErr, nErr, szMessage);
LocalFree(lpMsgBuf);
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 3-Mar-11 2:20am    
Correct, my 5.
Please pay attention, OP repeats questions and do not pay enough attention to Answers, got my warning...
---SA
Andrew Brock 3-Mar-11 2:21am    
Apparently I havn't been paying attention. Thanks.
Gokulnath007 3-Mar-11 2:21am    
I am using Windows 7 OS 64 bit. CreateEvent returns 0x0 value to the handle.. How to implement Createevent in Windows? pls help me..
Andrew Brock 3-Mar-11 2:23am    
Perhaps you should learn MSDN. Check out http://www.google.com.au/search?hl=en&client=firefox-a&rls=org.mozilla:en-US:official&hs=Rpz&q=CreateEvent%20site:msdn.microsoft.com&meta=

The same code can be used for printing the error associated with most Windows API functions.
I suspect your event name is malformed.
Sergey Alexandrovich Kryukov 3-Mar-11 13:59pm    
You need to show your code!
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900