注册消息试试
#include <WindowsConstants.au3>
#include <GuiMenu.au3>
$Form1 = GUICreate("Form1", 361, 253, 192, 124)
$Button1 = GUICtrlCreateButton("按钮", 86, 45, 75, 25)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND")
While 1
Switch GUIGetMsg()
Case $Button1
Button1Click()
EndSwitch
WEnd
Func Button1Click()
$a = TimerInit()
Local $Body
$oHTTP = ObjCreate("Msxml2.xmlhttp")
$oHTTP.Open('GET', 'http://www.autoitx.com/thread-30906-1-1.html&t=' & Random(0, 1), True);
$oHTTP.Send()
ToolTip(TimerDiff($a))
$Body = $oHTTP.responseBody
EndFunc ;==>Button1Click
Func WM_SYSCOMMAND($hWnd, $sMsg, $sWParam, $slParam)
Switch $sWParam
Case $SC_CLOSE ;结束程序
Exit
EndSwitch
EndFunc ;==>WM_SYSCOMMAND
|