首页 > Windows开发 > 详细

Get the Handle Of the Main Window in WPF

时间:2016-06-04 14:46:59      阅读:199      评论:0      收藏:0      [点我收藏+]

  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

原文:http://www.cnblogs.com/Bita/p/5558706.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!