#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
_IEErrorHandlerRegister ()
$oIE = _IECreateEmbedded ()
GUICreate("IE GUI测试", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2)
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 640, 580)
GUISetState() ;Show GUI
ObjEvent($oIE, "IE_", "DWebBrowserEvents2")
_IENavigate ($oIE, @ScriptDir & "\demo\Main.html")
While $oIE.Busy
Sleep(10)
WEnd
; Waiting for user to close the window
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
GUIDelete()
Exit
Func IE_DocumentComplete()
ObjEvent(_("btnTest"), "btnTest_")
ObjEvent(_("btnExit"), "btnExit_")
EndFunc
Func btnExit_onclick()
Exit
EndFunc
Func btnTest_onclick()
MsgBox(8192 + 64, "autoit消息", "Hello " & $oIE.document.getElementById("txtName").value)
EndFunc
;下面是快捷函数
Func _($id)
Return $oIE.document.getElementById($id)
EndFunc
|