Send Message 和 Post Message 之间有什么区别,它们与 C#、WPF 和 Pure windows 编程有什么关系? [英] What is the difference between Send Message and Post Message and how these relate to C# ,WPF and Pure windows programming?

查看:18
本文介绍了Send Message 和 Post Message 之间有什么区别,它们与 C#、WPF 和 Pure windows 编程有什么关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

What is the difference between Send Message and Post Message ( in terms of pure windows programming) and how these relate to C# ,WPF and Pure windows programming?

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

I am new to Threading and all related stuff so please excuse me for obvious quesiton . I need to dig out the externals of Threading .. Please let me know the links that help me to build my concept from win32 programming to WPF.

我需要理解从 Post 消息到 Afx(调用启动一个新线程)来将 Invok/Begin Invoke 委托给 Dispatcher.

I need to underderstand from Post message to Afx ( call to start a new thread ) to delegate Invok/Begin Invoke to Dispatcher.

推荐答案

PostMessage(在纯 windows 编程"中,又名 win32 API)是 异步,即引用文档:

PostMessage (in "pure windows programming", aka win32 API) is asynchronous, i.e., to quote the docs:

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

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.

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

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

SendMessage同步,也就是再次引用:

SendMessage is synchronous, that is, again quoting:

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

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.

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

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.

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

A good tutorial on these two functions and their use is here.

与 WPF 的连接在 这个问题.

The connection to WPF is discussed in this SO question.

这篇关于Send Message 和 Post Message 之间有什么区别,它们与 C#、WPF 和 Pure windows 编程有什么关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆