如楼上的例子还是解决不了问题
帮忙改一下了,我要让DOS回显的内容写在列表框中。谢谢
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
Opt('MustDeclareVars', 1)
Local $add, $clear, $mylist, $Button1, $nmsg
#Region ### START Koda GUI section ### Form=
GUICreate("AForm1", 633, 451, 193, 125)
$mylist = GUICtrlCreateList("", 5, 32, 721, 97)
GUICtrlSetLimit(-1, 200)
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("Button1", 8, 408, 617, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_test()
EndSwitch
WEnd
Func _test()
Local $foo,$line,$lines,$currentRead
$foo = Run(@ComSpec & " /c v.bat", @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
$lines =""
While 1
if $foo then
$line = StdoutRead($foo,0,1)
If @error Then ExitLoop
If $line Then
$currentRead = StdoutRead($foo)
GUICtrlSetData($mylist, $currentRead, 1)
MsgBox(0,"test",$currentRead)
EndIf
EndIf
Wend
EndFunc
[ 本帖最后由 redapple2008 于 2008-8-7 00:12 编辑 ] |