WinWaitMuxWaitSem is similar to DosWaitMuxWaitSem and enables a thread to wait for a muxwait semaphore to clear or for a window message sent by the WinSendMsg function from another thread to be received.

This function can be issued by any thread in the process that created the semaphore. Threads in other processes can also issue this function, but they must first gain access to the semaphore by issuing DosOpenMuxWaitSem.

Since the processing of a window message may take longer than the value specified by the ulTimeout parameter, this function may not return within the time specified by that value.

If the main thread (which normally processes messages) is waiting on a semaphore for a prolonged period of time, messages will not be processed, and the "Bad App" dialog can occur. This is expected behavior. To avoid this, a message-box can be displayed telling the user that the window is being initialized. While the window loads, that message box can process the incoming system messages.


[Back] [Next]