WaitMessage 函数 (winuser.h)

阻止线程执行,直到线程需要处理新消息。 新消息可以是输入消息、排队消息或非排队消息。

Syntax

BOOL WaitMessage();

Return value

Type: BOOL

如果函数成功,则返回值为非零。

如果函数失败,则返回值为零。 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. 现有的未处理消息(在上次检查队列之前收到)不被视为新消息。

Requirements

Requirement Value
最低支持的客户端 Windows 2000 Professional [仅限桌面应用]
支持的最低服务器 Windows 2000 Server [仅限桌面应用]
Target Platform Windows
Header winuser.h (包括 Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-4(在 Windows 10 版本 10.0.14393 中引入)

See also

Conceptual

GetMessage

消息和消息队列

PeekMessage

Reference