简体   繁体   中英

cpp win7 console without scrollbars

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.

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM