#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Ping Close", 357, 196, -1, -1)
GUISetIcon("D:\009.ico")
$GroupBox1 = GUICtrlCreateGroup("Ping", 8, 8, 257, 73)
$Label1 = GUICtrlCreateLabel("IP :", 40, 36, 28, 17)
$InputIP = GUICtrlCreateInput("", 78, 32, 137, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Start = GUICtrlCreateButton("Start(&S)", 272, 40, 75, 25, 0)
$stop = GUICtrlCreateButton("Stop(&C)", 272, 88, 75, 25, 0)
$state = GUICtrlCreateInput("", 8, 88, 257, 80, $WS_DISABLED)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Start
GUICtrlSetState($InputIP, $GUI_DISABLE)
GUICtrlSetState($Start, $GUI_DISABLE)
AdlibRegister("pin")
Case $stop
GUICtrlSetState($stop, $GUI_DISABLE)
GUICtrlSetState($InputIP, $GUI_ENABLE)
GUICtrlSetState($Start, $GUI_ENABLE)
AdlibUnRegister("pin")
GUICtrlSetState($stop, $GUI_ENABLE)
EndSwitch
WEnd
Func Pin()
Local $ip, $pid
$IP = GUICtrlRead ($InputIP)
$pid = ProcessExists("thunder.exe")
$pin = Ping($IP)
If $pin Then
If $pid Then
ProcessClose($pid)
GUICtrlSetData($state, "通信正常,迅雷关闭")
EndIf
Else
If Not ProcessExists("thunder.exe") Then
Run("D:\Program Files\Thunder Network\Thunder\Program\Thunder.exe")
GUICtrlSetData($state, "通信失败,迅雷工作")
EndIf
EndIf
EndFunc ;==>Pin