Win32 console application (printf, fgets, etc)
opens famous 25x80 "black box".I want my application to programmatically set
different width and height, other than 25x80.Whi开发者_如何学JAVAch APIs can I use to resize my console windows ?
Thanks
Sets the console size to 210*50 and the buffer to 210*2000
COORD s = { 210, 2000 };
SMALL_RECT sr = { 0, 0, 209, 49 };
CONSOLE_SCREEN_BUFFER_INFO sbi = { 0 };
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &sbi);
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), s);
if ( (sbi.srWindow.Right - sbi.srWindow.Left) != (sr.Right - sr.Left) ) {
SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE), TRUE, &sr);
}
For the record, I achievd what I needed using weird line
system("mode 42,90");
So weird, but simple, and it worked.
精彩评论