Click here to Skip to main content
12,077,911 members (47,985 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VC8.0 C++
How to resolve Waitformultipleobjects returning -1?
Posted 2-Mar-11 21:02pm
Comments
SAKryukov 3-Mar-11 2:21am
   
Why didn't you read the help on this API as I suggested?
--SA

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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);
  Permalink  
v2
Comments
SAKryukov 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.
SAKryukov 3-Mar-11 13:59pm
   
You need to show your code!
--SA
Sandeep Mewara 3-Mar-11 2:22am
   
Good answer. 5!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160212.1 | Last Updated 3 Mar 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100