如何获取窗体中Object的句柄?[已解决]
本帖最后由 longwin9 于 2012-1-5 09:19 编辑#include<ie.au3>
$Form1 = GUICreate("form1",1000, 600)
$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE,0, 0, 1000, 600)
$oIE.navigate("http://www.163.com/")
GUISetState(@SW_SHOW)
MsgBox(0,'a',GUICtrlGetHandle($oIE));此获取不到
MsgBox(0,'a',$oIE.hwnd);此错误 回复 1# longwin9
貌似此时的IE句柄已经等于内嵌窗口句柄了吧,也不会获取到IEFrame,你用_WinAPI_EnumWindows()测试下就知道了$Guid =_WinAPI_EnumWindows()
For $i = 1 To $Guid
If $guid[$i] = "IEFrame" Then
_WinAPI_ShowWindow($Guid[$i],@SW_MAXIMIZE)
$hwnd = $Guid[$i]
MsgBox(0,"IE句柄",$hwnd)
EndIf
Next OK!!感谢2楼提供思路#include<ie.au3>
#Include <WinAPIEx.au3>
#Include <Array.au3>
$Form1 = GUICreate("form1",1000, 600)
$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE,0, 0, 1000, 600)
$oIE.navigate("http://www.163.com/")
GUISetState(@SW_SHOW)
WinActivate('form1');没有这一行有时获取不到
$Data = _WinAPI_EnumChildWindows ($Form1 )
_ArrayDisplay($Data, '_WinAPI_EnumChildWindows')
MsgBox(0,$Data,$Data) $oIE1 = _IEAttach($Data, "HWND")
$html = _IEBodyReadHTML($oIE1)为什么这样得不到源码呢?
页:
[1]