本帖最后由 lsh127k 于 2010-6-18 16:03 编辑
我是要提取cmd运行后的回显,然后在编辑框中显示,希望能和cmd中直接运行命令的效果相似,但是当回显很长的时候,会从中间某个地方开始后面的就不会显示了。回显较少的时候是没问题的。比如运行ping。Func Chklogo()
Local $foo,$line,$lines
GUICtrlSetData($display," ")
$chklogoDir = GUICtrlRead($chklogo)
$foo = Run(@ComSpec & " /c "&$chklogoDir&" /mda", @WindowsDir, @SW_HIDE, $STDOUT_CHILD)
;$foo = Run(@ComSpec & " /c ping -n 10 127.0.0.1", @WindowsDir, @SW_HIDE, $STDOUT_CHILD)
$lines = ""
While 1
$line = StdoutRead($foo)
If @error Then ExitLoop
If $line = "" Or $line = " " Then
ContinueLoop
EndIf
$lines = $line
GUICtrlSetData($display, $lines, " ")
;MsgBox(0,"", $line)
Wend
;MsgBox(0,"", $lines)
;ConsoleWrite($lines)
EndFunc
|