C - WinAPI - 向线程发送消息并等待它

标签 c multithreading winapi process message

我想在 WinAPI 中发送一条消息到在其他线程中创建的窗口,然后等待处理这条消息。

这可能吗?提前致谢。

最佳答案

使用 SendMessage() 向窗口发送消息。

SendMessage() 阻塞调用线程,直到消息被目标窗口的消息调度程序处理。

来自 SendMessage()'s documentation :

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.

关于C - WinAPI - 向线程发送消息并等待它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23982448/

相关文章:

c - Eclipse C 包含 .h 文件时出现问题

c - K&R Exercise 3-2 垃圾字符

c++ - Windows 消息循环

c - 我可以在文件系统驱动程序中的 ZwCreateFile/InitializeObjectAttributes 中设置/检查用户定义的标志吗?

winapi - 以编程方式启用/禁用多点触控手指输入?

c - C lower_bound 的实现

c - printf 语句中的不同数据类型变量在打印顺序中如何相互影响

c++ - 使用 <thread> 在 C++ 中并发线程

java - 服务器上的多线程应用程序比单线程慢(与 JUnit 测试不同)

c# - Webbrowser InvokeScript 函数阻塞 Windows Phone 8 中的 UI 线程