Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function checks a thread message queue for a message and places the message (if any) in the specified structure.
BOOL PeekMessage( LPMSG lpMsg , HWND hWnd , UINT wMsgFilterMin , UINT wMsgFilterMax , UINT wRemoveMsg );
Parameters
Value | Description |
---|---|
PM_NOREMOVE | Messages are not removed from the queue after processing by PeekMessage. |
PM_REMOVE | Messages are removed from the queue after processing by PeekMessage. An exception is WM_PAINT messages, which are not removed from the queue. |
You can optionally combine the value PM_NOYIELD with either PM_NOREMOVE or PM_REMOVE. This flag prevents the system from releasing any thread that is waiting for the caller to go idle.
Return Values
Nonzero indicates success. Zero indicates failure.
Remarks
Unlike the GetMessagefunction, the PeekMessagefunction does not wait for a message to be placed in the queue before returning.
PeekMessageretrieves only messages associated with the window identified by the hWndparameter or any of its children as specified by the IsChildfunction, and within the range of message values given by the wMsgFilterMinand wMsgFilterMaxparameters. If hWndis NULL, PeekMessageretrieves messages for any window that belongs to the current thread making the call. ( PeekMessagedoes not retrieve messages for windows that belong to other threads.) If hWndis –1, PeekMessageonly returns messages with a hWndvalue of NULL, as posted by the PostThreadMessagefunction. If wMsgFilterMinand wMsgFilterMaxare both zero, PeekMessagereturns all available messages (that is, no range filtering is performed).
The WM_KEYFIRST and WM_KEYLAST constants can be used as filter values to retrieve all keyboard messages; the WM_MOUSEFIRST and WM_MOUSELAST constants can be used to retrieve all mouse messages.
The PeekMessagefunction does not remove WM_PAINT messages from the queue. WM_PAINT messages remain in the queue until they are processed.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winuser.h | Msgque.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
GetMessage, IsChild, PostThreadMessage, MSG