Edit

Share via


WaitMessage function (winuser.h)

Blocks thread execution until the thread needs to process a new message. The new message could be an input message, a queued message, or a non-queued message.

Syntax

BOOL WaitMessage();

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Note that WaitMessage does not return for unprocessed messages reported by a previous function which checks the queue. This is because functions such as PeekMessage, GetMessage, GetQueueStatus, WaitMessage, MsgWaitForMultipleObjects, and MsgWaitForMultipleObjectsEx check the queue and then change the state information for the queue so that the message is no longer considered new. A subsequent call to WaitMessage will not return until new messages arrive. The existing unprocessed messages (received prior to the last time the thread checked the queue) are not considered to be new.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows 10, version 10.0.14393)

See also

Conceptual

GetMessage

Messages and Message Queues

PeekMessage

Reference