CAMMsgEvent.WaitMsg method
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
The WaitMsg
method 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.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|