The CAMMsgEvent class is a wrapper for event objects that do message processing. This class adds one method to the CAMEvent object to allow sent messages to be processed while waiting.
Member Functions
| Name | Description |
| WaitMsg | Allows sent messages to be processed while waiting for an event to be signaled or for the indicated time-out to occur. |
Allows sent messages to be processed while waiting for an event to be signaled or for the indicated time-out to occur.
BOOL WaitMsg(
DWORD dwTimeOut
);
Returns TRUE if the event is signaled, or FALSE if the time-out occurred.
Call CAMMsgEvent::WaitMsg rather than CAMEvent::Wait if you want to block on a time-out or a signaled event and continue to process sent messages. If you do not process messages and another thread sends you a message, deadlock could occur. For example, if you create a thread by way of the Win32 CreateThread function and then block until the thread can initialize, deadlock will occur if the thread sends a message to your window using the Win32 SendMessage function. This is because SendMessage does not return until the message has been processed. CAMMsgEvent::WaitMsg allows SendMessage to return to the caller by using a Win32 PeekMessage loop to do message processing.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.