c# - Send Message 和 Post Message 之间有什么区别,它们与 C#、WPF 和纯 Windows 编程有什么关系?

标签 c# wpf winapi

Send Message 和 Post Message(就纯 windows 编程而言)有什么区别,它们与 C#、WPF 和纯 windows 编程有什么关系?

我是线程和所有相关内容的新手,所以请原谅我提出明显的问题。 我需要挖掘线程的外部结构。请让我知道帮助我构建从 win32 编程到 WPF 的概念的链接。

我需要了解从 Post 消息到 Afx(启动新线程的调用)以将 Invok/Begin Invoke 委托(delegate)给 Dispatcher。

最佳答案

PostMessage(在“纯 Windows 编程”中,也称为 win32 API)是 asynchronous ,即引用文档:

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.

To post a message in the message queue associated with a thread, use the PostThreadMessage function.

SendMessagesynchronous ,即再次引用:

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.

To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.

关于这两个函数及其使用的一个很好的教程是 here .

与 WPF 的连接在 this SO question 中讨论。 .

关于c# - Send Message 和 Post Message 之间有什么区别,它们与 C#、WPF 和纯 Windows 编程有什么关系?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3376619/

相关文章:

c# - System.Timers 定时器不触发事件

c++ - 关于windows下文件操作的问题

c# - 当绑定(bind)属性强制执行某些业务规则时,绑定(bind) WPF TextBox 不会更新值

c# - 尽管 namespace 中存在类,但获取 XMLNS 名称未找到错误

c# - 如何在WPF文本 block 验证错误上显示消息框

c# - 如何以编程方式确定 Windows 任务栏是否隐藏?

c++ - 删除以子字符串开头的文件

c# - 如何检测是否从 C# for Firefox 安装了 flash?

c# - 异步 Azure SQL 调用的 ReliableSqlConnection 替代方法

c# - 带有 Silverlight 应用程序的套接字?