【发布时间】:2012-05-27 08:47:43
【问题描述】:
我的 WPF 应用程序有多个窗口,我需要能够获取每个 Window 实例的 hWnd 以便在 Win32 API 调用中使用它们。
我想做的例子:
Window myCurrentWindow = Window.GetWindow(this);
IntPtr myhWnd = myCurrentWindow.hWnd; // Except this property doesn't exist.
最好的方法是什么?
【问题讨论】:
-
@HansPassant:另一个问题涉及弹出控件,而不是实际的窗口。 (是的,这个问题里面也间接回答了,但不是重复的。)