zhudizi521 发表于 2008-10-27 15:22:02

检查的内容如何从list1中显示出来。

检查的内容如何从list1中显示出来。但不打开DOS窗口

#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
RunWait("ping 10.1.40.1 "); 打开ping
Case $Button2
RunWait("ping www.baidu.com "); 打开ping

        EndSwitch
WEnd

liongodmien 发表于 2008-10-27 15:44:54


#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

zhudizi521 发表于 2008-10-27 21:04:07

谢谢

我是刚开学。好多代码还没有看明白。
页: [1]
查看完整版本: 检查的内容如何从list1中显示出来。