SendMessage 与Postmessage区别

来源:互联网 发布:手机淘宝上怎么看直播 编辑:程序博客网 时间:2024/05/21 22:39

今天面试被问到SendMessage 与Postmessage有什么区别,还真不知道,被问的哑口无言,回来查了下,还真是有点不一样.

MSDN 是提到

The SendMessage member function calls the window procedure directly and does not return until that window procedure has processed the message. This is in contrast to the PostMessage member function, which places the message into the window's message queue and returns immediately.

 

SendMessage就是同步函数,它不但发送消息到消息队列,还需要等待消息被执行完才返回;相反PostMessage就是个异步函数,它只管发送一个消息,而不管这个消息是否被处理,就马上返回。

原创粉丝点击