SendMessage 与 PostMessage

先看MSDN的解释:

SendMessage:

The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message.

SendMessage函数将指定的消息发到窗口。它调用特定窗口的窗口处理函数,并且不会立即返回,直到窗口处理函数处理了这个消息。

 

PostMessage:

The PostMessage function 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.

PostMessage函数将一个消息放入与创建这个窗口的消息队列相关的线程中,并立刻返回不等待线程处理消息。

 

SendMessage所发送的消息是会调用WndProc,等待WndProc处理消息并返回后它才返回。

PostMessage是向指定的窗口的线程的消息队列中发送当前的消息,并且立即返回。

posted @ 2015-12-23 18:18  sev  阅读(241)  评论(0编辑  收藏  举报