console buffer size

Just starting out? Need help? Post your questions and find answers here.
mdp
Enthusiast
Enthusiast
Posts: 115
Joined: Mon Apr 18, 2005 8:28 pm

console buffer size

Post by mdp »

I try to change a console buffer (read: the max width of text, indipendent from the window size)

Code: Select all

OpenConsole() : stdout.l=GetStdHandle_(#STD_OUTPUT_HANDLE)  
sz.COORD : sz\x=120 : sz\y=200

;sbi.console_screen_buffer_info : getconsolescreenbufferinfo_(stdout,sbi) 

ok=setconsolescreenbuffersize_(stdout,@sz)
PrintN( Str(ok) )
PrintN( Str( getlasterror_() ) )
Delay(3000)
but I get error 87 (invalid parameter).
Anybody can see why?
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

You need to pass a COORD structure, not an adress to a COORD struct. Basically here it's only a long:

Code: Select all

OpenConsole() : stdout.l=GetStdHandle_(#STD_OUTPUT_HANDLE) 
sz.COORD : sz\x=120 : sz\y=200

;sbi.console_screen_buffer_info : getconsolescreenbufferinfo_(stdout,sbi)

ok=SetConsoleScreenBufferSize_(stdout,120 | (200 << 16))
PrintN( Str(ok) )
PrintN( Str( GetLastError_() ) )
Delay(3000)
mdp
Enthusiast
Enthusiast
Posts: 115
Joined: Mon Apr 18, 2005 8:28 pm

Post by mdp »

Thanks!
Post Reply