本帖最后由 zerobin 于 2012-6-9 17:23 编辑 #include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
$Form1 = GUICreate("123", 300, 400, -1, -1, $WS_POPUP + $WS_CLIPCHILDREN)
$1 = ObjCreate("Shell.Explorer.2")
$2 = GUICtrlCreateObj($1, 0, 0, 300, 220)
$1.navigate("www.hao123.com")
$3 = GUICtrlCreateButton("123",0,310)
GUISetState()
$form1hwnd = ControlGetHandle("","",$3)
MsgBox(0,0,$form1hwnd)
While 1
Sleep(100)
WEnd
上面可以用ControlGetHandle获得按钮的句柄。
怎么用ControlGetHandle("","",$2)不能获得内嵌IE的句柄呢?
解决办法在本论坛搜索到http://www.autoitx.com/forum.php ... hlight=%BE%E4%B1%FA:#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[3][1],$Data[3][0])
|