#include <Constants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("David科大内部测试", 413, 300, 362, 183)
$List1 = GUICtrlCreateList("", 40, 112, 121, 136)
$List2 = GUICtrlCreateList("", 224, 112, 121, 136)
$Button1 = GUICtrlCreateButton("检查网关", 56, 48, 73, 33, 0)
$Button2 = GUICtrlCreateButton("检查外网", 248, 48, 73, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$run = Run(@ComSpec & " /c ping 10.1.40.1", '', @SW_HIDE, $STDOUT_CHILD); 打开ping
ProcessWaitClose($run)
$string = StdoutRead($run)
MsgBox(0,'',$string)
$string = StringRegExpReplace($string, '\n', '|', 0)
GUICtrlSetData($List1, $string)
Case $Button2
$run = Run(@ComSpec & " /c ping www.baidu.com", '', @SW_HIDE, $STDOUT_CHILD); 打开ping
ProcessWaitClose($run)
$string = StdoutRead($run)
MsgBox(0,'',$string)
$string = StringRegExpReplace($string, '\n', '|', 0)
GUICtrlSetData($List2, $string)
EndSwitch
WEnd
|