PostMessage();//将消息丢在消息队列就不管了
SendMessage();//等待消息处理,同步函数
SendMessageTimeout();//可以广播信息或者单独发信息,有超时时间,可以设置处理类型,通过fuFlags来设置
fuFlags
- SMTO_NORMAL 超时就返回,不管消息是否起作用
- 其他的据以下可得
Value |
Meaning |
-
SMTO_ABORTIFHUNG
-
0x0002
|
The function returns without waiting for the time-out period to elapse if the receiving thread appears to not respond or "hangs." |
-
SMTO_BLOCK
-
0x0001
|
Prevents the calling thread from processing any other requests until the function returns. |
-
SMTO_NORMAL
-
0x0000
|
The calling thread is not prevented from processing other requests while waiting for the function to return. |
-
SMTO_NOTIMEOUTIFNOTHUNG
-
0x0008
|
The function does not enforce the time-out period as long as the receiving thread is processing messages. |
-
SMTO_ERRORONEXIT
-
0x0020
|
The function should return 0 if the receiving window is destroyed or its owning thread dies while the message is being processed. |
```c
LRESULT SendMessageTimeoutA(
[in] HWND hWnd,
[in] UINT Msg,
[in] WPARAM wParam,
[in] LPARAM lParam,
[in] UINT fuFlags,
[in] UINT uTimeout,
[out, optional] PDWORD_PTR lpdwResult
);
```
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步