本帖最后由 xuerilangzi 于 2014-10-8 17:05 编辑 #include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ie.au3>
$oIE = ObjCreate("Shell.Explorer.1")
#Region ### START Koda GUI section ### Form=
$GUIMain = GUICreate("GUIMain", 800, 600, 0, 0)
GUICtrlCreateObj($oIE, 0, -0, 800, 600)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents")
$URL = "http://www.hao123.com/"
$oIE.Navigate( $URL )
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func IEEvent_NewWindow($ppDisp,$Cancel)
Local $o_Shell = ObjCreate("Shell.Application")
Local $o_ShellWindows = $o_Shell.Windows(); collection of all ShellWindows (IE and File Explorer)
For $i = $o_ShellWindows.Count-1 To 0 Step -1
If $o_ShellWindows.item($i).LocationURL==$ppDisp Then
$o_ShellWindows.item($i).quit()
EndIf
Next
$oIE.Navigate( $ppDisp )
EndFunc
|