Get the Handle Of the Main Window in WPF

Posted < / >

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Get the Handle Of the Main Window in WPF相关的知识,希望对你有一定的参考价值。

  WinForm中获取窗体句柄用this.Handle就行了。

   但WPF中有点麻烦,需要先引用命名空间:

1 using System.Windows.Interop;

  然后调用方法:

1 IntPtr Handle = new WindowInteropHelper(this).Handle;

  其中this指的是要获取的Window的实例,方法返回后,Handle正是Window的句柄。

以上是关于Get the Handle Of the Main Window in WPF的主要内容,如果未能解决你的问题,请参考以下文章

the example of dlsym

新vm打开以前的虚拟机报错"Could not get vmci driver version: The handle is invalid."

Given a matrix, get the number of path from the top left cell to the top right cell.

systemtap get var of the tracepoing

error execution phase preflight: couldn't validate the identity of the API Server: Get https://1

zoj 2771 - Get Out of the Glass