mfcSendMessage和postMessage
时间: 2023-10-06 11:11:57 浏览: 137
MFC中的SendMessage和PostMessage是用于发送消息给窗口的两个函数。这两个函数有一些区别。
首先,SendMessage是一个阻塞型函数,而PostMessage是非阻塞型函数。也就是说,当调用SendMessage发送消息时,程序会一直等待窗口处理完该消息后才返回,而调用PostMessage发送消息后会立即返回。
其次,这两个函数在返回值上也有所不同。SendMessage的返回值是LRESULT类型,而PostMessage的返回值是BOOL类型。
总结起来,SendMessage是一个同步的消息发送函数,会等待窗口处理完消息后才返回。而PostMessage是一个异步的消息发送函数,会立即将消息放入窗口的消息队列后就返回。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [【MFC】SendMessage与PostMessage](https://blog.csdn.net/qq_45662588/article/details/121417438)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [MFC的SendMessage用法](https://blog.csdn.net/sinat_31608641/article/details/103780020)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文