#AccAu3Wrapper_UseX64=n
#AccAu3Wrapper_Change2CUI=Y
#NoTrayIcon
Local $lines = 15, $cols = 50
_SetConsoleSize($lines, $cols)
Sleep(50000)
Func _SetConsoleSize($lines = 15, $cols = 50)
Local $aRet, $iErr, $hConsoleOut, $tCoord, $tDword
Local Const $INVALID_HANDLE_VALUE = -1
Local Const $STD_INPUT_HANDLE = -10
Local Const $STD_OUTPUT_HANDLE = -11
Local Const $STD_ERROR_HANDLE = -12
Local Const $tagSMALL_RECT = 'SHORT Left;SHORT Top;SHORT Right;SHORT Bottom;'
$aRet = DllCall("Kernel32.dll", "hwnd", "GetStdHandle", "dword", $STD_OUTPUT_HANDLE)
If @error Or UBound($aRet) <> 2 Or $aRet[0] = $INVALID_HANDLE_VALUE Then
Return SetError(1, 0, 0)
EndIf
$hConsoleOut = $aRet[0]
$tCoord = DllStructCreate("SHORT X;SHORT Y;")
DllStructSetData($tCoord, "X", $cols)
DllStructSetData($tCoord, "Y", $lines)
$tDword = DllStructCreate("DWORD Coord", DllStructGetPtr($tCoord))
DllCall("kernel32.dll", "BOOL", "SetConsoleScreenBufferSize", "handle", $hConsoleOut, "DWORD", DllStructGetData($tDword, "Coord"))
$tSMALL_RECT = DllStructCreate($tagSMALL_RECT)
DllStructSetData($tSMALL_RECT, 3, $cols - 2)
DllStructSetData($tSMALL_RECT, 4, $lines - 2)
DllCall("Kernel32.dll", "bool", "SetConsoleWindowInfo", "handle", $hConsoleOut, 'BOOL', True, 'struct*', $tSMALL_RECT)
DllCall("Kernel32.dll", "bool", 'SetConsoleTitleW', 'wstr', '控制台 lines=' & $lines & ' cols=' & $cols)
ConsoleWrite(@CRLF & 'lines=' & $lines & @CRLF & 'cols=' & $cols)
$tCoord = 0
$tSMALL_RECT = 0
$tDword = 0
EndFunc
|