看看这个能不能实现你的要求:#include <ButtonConstants.au3>
#include <Constants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
$Form1 = GUICreate("dos回显", 330, 250)
$IPAddress = _GUICtrlIpAddress_Create($Form1, 70, 3, 120, 16)
_GUICtrlIpAddress_Set($IPAddress, "127.0.0.1")
GUICtrlCreateLabel("IP地址:", 5, 4, 46, 17)
$Ping = GUICtrlCreateButton("Ping", 250, 2, 65, 18, 0)
$Edit = GUICtrlCreateEdit("", 0, 24, 330, 220)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Ping
_Ping()
EndSwitch
WEnd
Func _Ping()
GUICtrlSetState($edit,$gui_disable)
$Result = Run(@ComSpec &" /c ping "&_GUICtrlIpAddress_Get($IPAddress)&" -n 10", "", @SW_HIDE, $STDOUT_CHILD)
While 1
$Line = StdoutRead($Result)
If @error Then ExitLoop
GUICtrlSetData($Edit, $Line, -1)
WEnd
GUICtrlSetState($edit,$gui_enable)
EndFunc
|