简体   繁体   English

通过句柄托管Win32,WinForms或WPF窗口?

[英]Hosting Win32, WinForms or WPF Window by handle?

I'm investigating if it's possible to host any type of window in WPF by handle. 我正在研究是否可以通过句柄在WPF中托管任何类型的窗口。 I've been exploring the HwndHost class, although all the examples I've come across is using a Win32 handle. 我一直在探索HwndHost类,尽管我遇到的所有示例都使用Win32句柄。 Is it possible to host any window type by handle? 是否可以通过句柄托管任何窗口类型?

Yes, it is possible. 对的,这是可能的。 Here is a quick link from MSFT on hosting Win32 controls: https://msdn.microsoft.com/en-us/library/aa970061.aspx 这是来自MSFT的托管Win32控件的快速链接: https : //msdn.microsoft.com/zh-cn/library/aa970061.aspx

I've actually worked on a project where we hosted a Java client application (don't ask why) inside a WPF control where we grabbed the Win32 handle from the Java application. 我实际上已经在一个项目中进行了工作,在该项目中,我们在WPF控件中托管了Java客户端应用程序(不要问为什么),在该控件中我们从Java应用程序中获取了Win32句柄。 Eventing can be tricky, but it can be done. 事件化可能很棘手,但可以做到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM