A | B | C |  D | E | F |  G | H | I |  J | K | L |  M | N | O |  P | Q | R |  S | T | U |  V | W | X |  Y | Z


The GetMessage function retrieves a message from the calling threadís message queue and places it in the specified structure. This function can retrieve both messages associated with a specified window and thread messages posted via the PostThreadMessage function.

Declare Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As MSG, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long

Operating Systems Supported
Requires Windows NT 3.1 or later; Requires Windows 95 or later


Parameter Information
- lpMsg
Points to an MSG structure that receives message information from the threadís message queue.

- hWnd
Identifies the window whose messages are to be retrieved. One value has a special meaning:
GetMessage retrieves messages for any window that belongs to the calling thread and thread messages posted to the calling thread via PostThreadMessage.

- wMsgFilterMin
Specifies the integer value of the lowest message value to be retrieved.

- wMsgFilterMax
Specifies the integer value of the highest message value to be retrieved.

Return Values
If the function retrieves a message other than WM_QUIT, the return value is nonzero.

If the function retrieves the WM_QUIT message, the return value is zero.

If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle.

Last update: 07 April 2006