Console Window Size
How can i change the size of the console window? eg. make it 24 x 24 characters? thanks
[ Tech 19 ]
Assuming you are using Windows and C or C++:
You need to call SetConsoleScreenBufferSize() to adjust the size of the screen buffer, then call SetConsoleWindowInfo() to change the size of the window itself.
You need to call SetConsoleScreenBufferSize() to adjust the size of the screen buffer, then call SetConsoleWindowInfo() to change the size of the window itself.
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
or in other words:
There ya go!
[edited by - Jeff D on January 9, 2003 5:09:56 PM]
[edited by - Jeff D on January 9, 2003 5:11:33 PM]
#include <windows.h>int main(){ HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); //You need this to use SetConsoleScreenBufferSize() COORD cdScreenSize = {24, 24}; // This will be the size you want the console to be SetConsoleScreenBufferSize(hOutput, cdScreenSize); return 0;}
There ya go!
[edited by - Jeff D on January 9, 2003 5:09:56 PM]
[edited by - Jeff D on January 9, 2003 5:11:33 PM]
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
After experimenting this way doesn''t allow you to get lower than 80 X 25. Sorry.
Jeff D
Jeff D
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
Oops, my bad. You'll want to call SetConsoleWindowInfo() first, then call SetConsoleScreenBufferSize().
[edited by - Martee on January 9, 2003 5:39:41 PM]
SMALL_RECT windowSize;COORD bufferSize;bufferSize.X = 24;bufferSize.Y = 24;windowSize.Bottom = 23;windowSize.Top = 0;windowSize.Left = 0;windowSize.Right = 23;if(!SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE), TRUE, &windowSize)) return 1;if(!SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), bufferSize)) return 1;
[edited by - Martee on January 9, 2003 5:39:41 PM]
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement