10
Hello, I was able to create a console window that does not show scrollbars:
CONSOLE_SCREEN_BUFFER_INFO csbi;
int columns, rows;
COORD size;
COORD BufSize;
while(TRUE) {
size = GetLargestConsoleWindowSize(GetStdHandle(STD_OUTPUT_HANDLE));
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
BufSize.X = columns;
BufSize.Y = rows;
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), BufSize);
sleep(5);
}
However, the console created by this code does not allow us to increase the size of the console, it can only reduce the size. For this I changed the following lines of code:
columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
To:
columns = csbi.srWindow.Right - csbi.srWindow.Left + 2;
rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 2;
This way, with some effort, you can increase the size of the console. However, in this way also reappear scroll bars, something I would like not to appear. Does anyone know any solution of how I would adapt the above code so that the scrollbars do not appear, keeping the console window fully resizable?
The scroll bar is displayed when the buffer size is larger than the window size.
– CypherPotato
@Cypherpotato Yes, I am aware of that fact, which is why I arrived at the results posed in the above question.
– Simple coder