我用以下方式启动服务器:
$BungeeServer = Run("java -Xmx512M -jar " & '"' & $file0 & "\BungeeCord.jar" & '"', $file0, $Hide, $STDERR_MERGED)
然后我从服务器获取数据(它在一个while循环中):
Assign("sOutput", StdoutRead($BungeeServer, False, False) & @CRLF)
GUICtrlSetData($Edit1, $sOutput)
问题是它只返回最新的信息字符串。我需要它来添加而不是替换值。有谁知道一个简单的方法来做到这一点?
编辑:当服务器启动时,您通常会得到一个 cmd 窗口。我希望能够将它放在 Gui 中。此外,我只希望它在单击按钮时出现,但它仍然应该在服务器启动时开始获取数据。文本行也在框外。我试过了:
Do
$msg1 = GUIGetMsg()
$line1 = StdoutRead($BungeeServer, True)
$totalOutput1 &= $line1 & @CRLF
GUICtrlSetData($Edit1, $totalOutput1)
$line2 = StdoutRead($1, True)
$totalOutput2 &= $line2 & @CRLF
GUICtrlSetData($Edit2, $totalOutput2)
$line3 = StdoutRead($2, True)
$totalOutput3 &= $line3 & @CRLF
Until $msg = $GUI_EVENT_CLOSE
编辑框是用:
$Form2 = GUICreate("Servers", @DesktopWidth - 15, @DesktopHeight - _GetTaskBarHeight() - 35, -1, -1)
$Edit1 = GUICtrlCreateEdit("", 0, 0, 634, 334, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))
Font()
$Edit2 = GUICtrlCreateEdit("", 635, 0, 634, 334, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))
Font()
$Edit3 = GUICtrlCreateEdit("", 634 + 634, 0, 634, 334, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))
Font()
GUISetState(@SW_SHOW)
编辑:我找到了一种更好的方法来制作一个子窗口并且不需要所有其他东西:
$GUI = GUICreate("Consoles", 1020, 600, 1282, 300, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_CLIPCHILDREN, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
If GUICtrlRead($Bungee) = 1 Then
$BungeeServer = Run("java -Xmx512M -jar " & '"' & $file0 & "\BungeeCord.jar" & '"', $file0, $Hide)
If Not ProcessWait($BungeeServer) = 0 Then
WinSetTitle("C:\Windows\system32\java.exe", "", "Bungee")
WinSetTitle("C:\WINDOWS\SYSTEM32\java.exe", "", "Bungee")
Global $hwnd0 = WinGetHandle("Bungee")
EndIf
EndIf
_WinAPI_SetWindowLong($hwnd0, $GWL_EXSTYLE, $WS_EX_MDICHILD)
_WinAPI_SetParent($hwnd0, $GUI)
WinMove($hwnd0, "", 0, 0, 340, 300)
仍然需要找到一种方法来使用 ControlSend 到子窗口:/