I'm trying to find a way of increasing the number of rows in a console buffer. Came across this old post by MichaelW :-
COORD STRUCT
x WORD ?
y WORD ?
COORD ENDS
buffer COORD <>
mov ax, buffer.y
shl eax, 16
mov ax, buffer.x
invoke SetConsoleScreenBufferSize, hConsoleOut, eax
Tried it out & it assembles O.K. but the console stays the same size, any suggestions.
thats for the size of the buffer for the window (ie: the amount of text retained before it clears, so you can scroll up / down, copy etc...)
for the physical size of the console window you need to use...
The SetConsoleWindowInfo function sets the current size and position of a console screen buffer's window.
BOOL SetConsoleWindowInfo(
HANDLE hConsoleOutput, // handle of console screen buffer
BOOL bAbsolute, // coordinate type flag
CONST SMALL_RECT *lpConsoleWindow // address of new window rectangle
);
Hi evlncrn8,
I think we are talking Cross purposes, it is the amount of text it will hold i.e. number of rows that I want to increase.
The default seems to be 256 rows, I want to double that.
This works on my system.
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.data
hConsoleOutput dd 0
max_coord COORD <>
small_rect SMALL_RECT <>
csbi CONSOLE_SCREEN_BUFFER_INFO <>
.code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hConsoleOutput, eax
invoke GetConsoleScreenBufferInfo,hConsoleOutput,ADDR csbi
print "console screen buffer rows = "
movzx eax,csbi.dwSize.y
print ustr$(eax),13,10
print "console screen buffer cols = "
movzx eax,csbi.dwSize.x
print ustr$(eax),13,10
print "console window left = "
movzx eax,csbi.srWindow.Left
print ustr$(eax),13,10
print "console window top = "
movzx eax,csbi.srWindow.Top
print ustr$(eax),13,10
print "console window right = "
movzx eax,csbi.srWindow.Right
print ustr$(eax),13,10
print "console window bottom = "
movzx eax,csbi.srWindow.Bottom
print ustr$(eax),13,10
movzx eax, csbi.dwSize.y
mov eax, 1000
shl eax, 16
mov ax, csbi.dwSize.x
invoke SetConsoleScreenBufferSize, hConsoleOutput, eax
invoke GetConsoleScreenBufferInfo,hConsoleOutput,ADDR csbi
print "console screen buffer rows = "
movzx eax,csbi.dwSize.y
print ustr$(eax),13,10
print "console screen buffer cols = "
movzx eax,csbi.dwSize.x
print ustr$(eax),13,10
inkey "Press any key to continue..."
cls
mov ebx, 1
.WHILE ebx < 1000
print ustr$(ebx),13,10
inc ebx
.ENDW
inkey "Press any key to exit..."
exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start
Thankyou MichaelW, :thumbu
I'll try that out when I can. I've got more pressing problems at the moment, coming from DOS it's a struggle to get my head around Windows way of doing things ::)
MichaelW,
Tried it out, & I see that changing the value in eax gives the number of rows I need, perfect :U
Many thanks it's saved me a lot of headscratching.