I'm looking for a code example that uses MsgWaitForMultipleObjects correctly. I'm only interested in waiting for one object, but this thread creates windows, so I can't use WaitForSingleObject. Every time I've tried doing it, it doesn't return before the timeout, even if the thread's window receives messages. I am passing a pointer to the object I am waiting for (a mutex) as the pHandles parameter. I am using QS_ALLEVENTS as the dwWakeMask parameter.