windowsh getmessage
The GetMessage function retrieves a message from the calling thread's message queue. The function blocks until a message is available. The GetMessage function is typically used in a message loop to process messages sent to a window.
The function prototype is as follows:
BOOL GetMessage(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax
);
Parameters:
- lpMsg: A pointer to an MSG structure that receives message information from the message queue.
- hWnd: A handle to the window whose messages are to be retrieved. If this parameter is NULL, GetMessage retrieves messages for any window that belongs to the current thread.
- wMsgFilterMin: The integer value of the lowest message value to be retrieved. Use WM_KEYFIRST (0x0100) to specify the first keyboard input message or WM_MOUSEFIRST (0x0200) to specify the first mouse input message.
- wMsgFilterMax: The integer value of the highest message value to be retrieved. Use WM_KEYLAST to specify the last keyboard input message or WM_MOUSELAST to specify the last mouse input message.
Return Value:
- If the function retrieves a message other than WM_QUIT, it returns a nonzero value.
- If the function retrieves the WM_QUIT message, it returns zero.
- If an error occurs or hWnd is an invalid window handle, the return value is -1.
Note: To process the message retrieved by GetMessage, you can use the DispatchMessage function to send the message to the appropriate window procedure.
原文地址: http://www.cveoy.top/t/topic/i2sx 著作权归作者所有。请勿转载和采集!