#include <IE.au3>
#include <GUIConstantsEx.au3>
$Stop=1
Opt("GUIOnEventMode", 1);OnEvent模式
GUICreate("反复打开百度", 200, 50,-1, -1)
$Button1 = GUICtrlCreateButton("开始", 20, 20, 55, 20)
$Button2 = GUICtrlCreateButton("停止", 110, 20, 55, 20)
GUISetState(@SW_SHOW)
WinSetOnTop("反复打开百度", "", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
GUICtrlSetOnEvent($Button1, "gui")
GUICtrlSetOnEvent($Button2, "gui")
While 1
If $Stop=0 Then
$msg = GUIGetMsg()
$oIE = _IECreate("http://www.baidu.com", 0, 1, 1, 1)
_IELoadWait($oIE)
Sleep(100)
_IEQuit($oIE)
EndIf
WEnd
Func gui()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Stop=0
Case $Button2
$Stop=1
EndSwitch
EndFunc
|