在winform中获取窗口句柄很简单,this.Handle。但在wpf中这个有点麻烦。
窗体:
IntPtr hwnd = new WindowInteropHelper(this).Handle;
控件:
IntPtr hwnd = ((HwndSource)PresentationSource.FromVisual(uielement)).Handle;
在winform中获取窗口句柄很简单,this.Handle。但在wpf中这个有点麻烦。
窗体:
IntPtr hwnd = new WindowInteropHelper(this).Handle;
控件:
IntPtr hwnd = ((HwndSource)PresentationSource.FromVisual(uielement)).Handle;
转载于:https://www.cnblogs.com/fornet/archive/2013/03/09/2976184.html