Microsoft DirectX 8.0

CAMMsgEvent Class

CAMMsgEvent class hierarchy

Wrapper class for event objects that perform message processing.

Declaration: Wxutil.h

This class derives from the CAMEvent object. It adds one method, WaitMsg, which dispatches incoming messages while waiting.

Public Methods
WaitMsgWaits for the event to be signaled, while dispatching sent messages.

CAMMsgEvent::WaitMsg

CAMMsgEvent Class

Waits for the event to be signaled, while dispatching sent messages.

Syntax

BOOL WaitMsg(
    DWORD dwTimeOut = INFINITE
);

Parameters

dwTimeOut
Optional time-out value, in milliseconds.

Return Value

Returns TRUE if the event is signaled, or FALSE if the time-out occurred.

Remarks

This method calls the PeekMessage function to process messages. Call this method instead of CAMEvent::Wait if your thread needs to process messages while waiting for an event. If the thread does not process messages and another thread sends a message, deadlock could occur.

For example, suppose you create a thread and then block until the thread initializes. If the thread sends a message to your window by calling the SendMessage function, it will result in a deadlock. This is because SendMessage does not return until the message has been processed. Calling WaitMsg allows the SendMessage call to return, preventing the deadlock.