本帖最后由 q410225 于 2017-1-7 11:47 编辑
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 307, 182, -1, -1)
$Label1 = GUICtrlCreateLabel("延时 MS", 80, 20, 56, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$button1 = GUICtrlCreateButton("开始", 20, 100, 50, 25)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$button2 = GUICtrlCreateButton("停止", 100, 100, 50, 25)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $button1 ;开始循环PING
AdlibRegister(chk,2000)
Case $button2 ;停止PING
AdlibUnRegister(chk)
GUICtrlSetData($Label1, "延时---MS")
EndSwitch
WEnd
Func chk()
GUICtrlSetData($Label1, "延时---MS")
Sleep(500)
$p = Ping("192.168.6.1", 400)
If $p Then
GUICtrlSetData($Label1, "延时"&$p&"MS")
EndIf
EndFunc ;==>chk
|