在WPF中獲取窗口句柄的方法(轉(zhuǎn))
在WPF中獲取窗口句柄的方法
來源:http://sfcyyc.blog.163.com/blog/static/101482919200991545715983/
我們?cè)陧?xiàng)目中使用WPF開發(fā)程序,需要調(diào)用一個(gè)Activex控件,顯示三維的場景,但是需要把當(dāng)前窗口的句柄傳遞給OCX控件,WPF窗口本身沒有句柄屬性,需要通過如下的方式實(shí)現(xiàn)轉(zhuǎn)換
int handle = new WindowInteropHelper(this).Handle.ToInt32();
//this代表當(dāng)前的窗口
int handle = new WindowInteropHelper(this).Handle.ToInt32();
//this代表當(dāng)前的窗口
posted on 2010-02-22 00:15 大寶pku 閱讀(2667) 評(píng)論(0) 收藏 舉報(bào)
浙公網(wǎng)安備 33010602011771號(hào)