本文介绍了在WPF控件本地Win32窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发需要一台主机机Win32窗口的应用程序,不知怎么我没有线索如何做到这一点。

I am developing an application that needs to a host native Win32 window and somehow i have no clues how to do that.

我需要创建一个WPF对话框窗口,可以显示在它本机Win32控制。该对话窗口将WPF在它控制的很好,所以我要寻找某种网格,我可以采取HWND并将其发送到非托管C ++的控制,因此它可以利用它。这可能吗?

I need to create a WPF dialog window that could display native Win32 control on it. This dialog window will have WPF controls on it as well, so i am looking for some sort of Grid that i could take HWND of and send it to the unmanaged C++ control, so it could draw on it.Is that possible ?

我并不需要知道面内发生了什么,只需要让C ++ DLL吸取它和所有我需要做的是通过HWND具有适当大小(我知道)。

I don't need to know what happens within that surface, just need to let C++ dll to draw on it and all i need to do is to pass HWND that has proper size (which i know).

我还挺新的WPF(用来做Win32编程),相当失落(不过我现在如何连接到C#.NET等)

I am kinda new to WPF (used to do win32 programming) and quite lost (but i now how to interface it to C# .NET etc)

将是巨大的,如果你可以给我任何提示:)

Would be great if you could send me any hints :)

推荐答案

你就可以开始按照此处的说明/步骤:的

you can start by following the instructions/steps here: Hosting Win32 Content in WPF

从文章的介绍:

Win32的深入了解Windows presentation框架演练(HwndHost)

要重复使用Win32的内容中WPF应用程序,使用HwndHost,这是  控制,使得HWNDs看起来像WPF内容。像HwndSource,  HwndHost是简单的使用方法:从HwndHost获得和实施  BuildWindowCore和DestroyWindowCore方法,然后实例化你的  HwndHost派生类,并把它放在您的WPF应用程序中。

如果您的Win32的逻辑已经被打包成一个控制,那么你的  BuildWindowCore实现比电话更小  CreateWindow的。

If your Win32 logic is already packaged as a control, then your BuildWindowCore implementation is little more than a call to CreateWindow.

那么,如果你有一个具体问题请在这里SO和人民将帮助您就具体问题。

then if you have a specific issue ask here in SO and people will help you on specific points.

这篇关于在WPF控件本地Win32窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 00:17