【问题标题】:What is the difference between Send Message and Post Message and how these relate to C# ,WPF and Pure windows programming?Send Message 和 Post Message 之间有什么区别以及它们与 C#、WPF 和纯 Windows 编程有何关系?
【发布时间】:2011-03-23 12:59:25
【问题描述】:

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

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

我需要了解从 Post message to Afx (call to start a new thread) 将 Invok/Begin Invoke 委托给 Dispatcher。

【问题讨论】:

    标签: c# wpf winapi


    【解决方案1】:

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

    在 与相关联的消息队列 创建指定的线程 窗口并返回而无需等待 处理消息的线程。

    在消息队列中发布消息 与线程相关联,使用 PostThreadMessage 函数。

    SendMessage就是synchronous,也就是再次引用:

    将指定的消息发送到 窗户或窗户。发送消息 函数调用窗口过程 对于指定的窗口,不 返回直到窗口过程 处理了消息。

    发送消息并返回 立即,使用 SendMessageCallback 或 SendNotifyMessage 函数。发布一个 消息到线程的消息队列 并立即返回,使用 PostMessage 或 PostThreadMessage 功能。

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

    this SO question 讨论了与 WPF 的连接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-19
      • 1970-01-01
      • 2016-09-06
      • 2020-04-29
      • 2015-06-19
      • 2012-06-12
      • 2012-03-20
      • 2016-10-17
      相关资源
      最近更新 更多