GetMessage (Windows CE 5.0)
This function retrieves a message from the calling thread's message queue and places it in the specified structure.
BOOLGetMessage(LPMSGlpMsg, HWNDhWnd, UINTwMsgFilterMin, UINTwMsgFilterMax );
[out] Pointer to an MSG structure that receives message information from the thread's message queue.
[in] Handle to the window whose messages are to be retrieved. One value has a special meaning.
Value Description NULL GetMessage retrieves messages for any window that belongs to the calling thread and thread messages posted to the calling thread by means of PostThreadMessage.
[in] Specifies the integer value of the lowest message value to be retrieved.
[in] Specifies the integer value of the highest message value to be retrieved.
Nonzero indicates that the function retrieves a message other than WM_QUIT. Zero indicates that the function retrieves the WM_QUIT message, or that lpMsg is an invalid pointer. To get extended error information, call GetLastError.
An application typically uses the return value to determine whether to end the main message loop and exit the program.
The GetMessage function only retrieves messages associated with the window identified by the hWnd parameter or any of its children, as specified by the IsChild function, and within the range of message values given by the wMsgFilterMin and wMsgFilterMax parameters. If hWnd is NULL, GetMessage retrieves messages for any window that belongs to the calling thread and thread messages posted to the calling thread by means of PostThreadMessage. GetMessage does not retrieve messages for windows that belong to other threads nor for threads other than the calling thread, even if hWnd is not NULL. Thread messages, posted by the PostThreadMessage function, have a message hWnd value of NULL. If wMsgFilterMin and wMsgFilterMax are both zero, GetMessage returns 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 messages related to keyboard input; the WM_MOUSEFIRST and WM_MOUSELAST constants can be used to retrieve all mouse messages. If the wMsgFilterMin and wMsgFilterMax parameters are both zero, the GetMessage function returns all available messages (that is, without performing any filtering).
GetMessage does not remove WM_PAINT messages from the queue. The messages remain in the queue until processed.
OS Versions: Windows CE 1.0 and later.
Link Library: Coredll.lib.
Send Feedback on this topic to the authors