您的位置:首页 > 其它

PostMessage 跟 SendMessage的区别

2016-03-23 14:29 309 查看
一般来说这种Windows API在MSDN上都有比较完整的描述,这里为了巩固记忆,把他记下来

BOOL WINAPI PostMessage(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)

把消息分发到与创建hwnd窗口相关联的线程的消息队列上,不需要等待线程处理消息,即刻返回

MSDN:

Places (posts) a message in the message queue associated with the thread that
created the specified window and

returns without waiting for the thread to
process the message.

BOOL WINAPI SendMessage(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)

这个函数直接调用hwnd窗口对应的窗口过程对消息进行处理,直到消息处理完成后才返回

MSDN:

Sends the specified message to a window or windows. The SendMessage function
calls the window procedure for

the specified window and does not return
until the window procedure has processed the message.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: