如何处理消息的WndProc在WPF? [英] How to handle WndProc messages in WPF?

查看:1113
本文介绍了如何处理消息的WndProc在WPF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查找WPF陡峭的学习曲线。

Finding WPF a steep learning curve.

在良好的醇'Windows窗体,我只是重写的WndProc ,并开始处理消息,因为他们进来了。

In good ol' Windows Forms, I'd just override WndProc, and start handling messages as they came in.

有人能告诉我如何实现在WPF中同样的事情的例子吗?

Can someone show me an example of how to achieve the same thing in WPF?

推荐答案

其实,据我了解这种事情确实有可能在WPF使用 HwndSource HwndSourceHook 。见<一href=\"http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/6b97a6de-0480-4339-8ed0-cb7cdb27bd83/\">this在MSDN上线中作为一个例子。 (在code发布工作正常 - 问题是关于一些稍微专业。)

Actually, as far as I understand such a thing is indeed possible in WPF using HwndSource and HwndSourceHook. See this thread on MSDN as an example. (The code posted works fine - the question is about something slightly specialised.)

现在,我不太清楚为什么你要在一个WPF应用程序来处理Windows消息的消息(除非它是互操作的与另一个WinForms应用程序的工作最明显的形式)。设计思想和API的性质是WPF来自WinForms的差异很大,所以我建议你刚刚熟悉WPF更清楚地看到的为什么的没有的WndProc的等价物。

Now, I'm not quite sure why you'd want to handle Windows Messaging messages in a WPF application (unless it's the most obvious form of interop for working with another WinForms app). The design ideology and the nature of the API is very different in WPF from WinForms, so I would suggest you just familiarise yourself with WPF more to see exactly why there is no equivalent of WndProc.

这篇关于如何处理消息的WndProc在WPF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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