Domanda

I'd like to remove the scrollbars from my console (like in the edit-command) because i want to make a qbasic-like program. I know that here is a thread but it does not work for me in windows 7 32bit. There is written that you only have to make the console screen buffer the same size as the console window.
This dont work:

HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hstdout, &csbi);

csbi.dwSize.X = csbi.srWindow.Right;
csbi.dwSize.Y = csbi.srWindow.Bottom;
SetConsoleScreenBufferSize(hstdout, csbi.dwSize);

Even if i set csbi.dwSize.X and Y to 10 or smaller, the scrollbars are there.

È stato utile?

Soluzione

The problem is the size information contained in srWindow is for the the screen buffer not the actual window. You want to use dwMaximumWindowSize which specifies the size of the window in columns and rows.

csbi.dwSize.X = csbi.dwMaximumWindowSize.X;
csbi.dwSize.Y = csbi.dwMaximumWindowSize.Y;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top