PostMessage 跟 SendMessage的區別

一般來說這種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.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章