I have been checking out some Rogue like games (Larn, Rogue, etc) that are written in C and C++, and I have noticed that they do not have the scrollbars to the right of the console window.
How can I accomplish this same feature?
I have been checking out some Rogue like games (Larn, Rogue, etc) that are written in C and C++, and I have noticed that they do not have the scrollbars to the right of the console window.
How can I accomplish this same feature?
These guys show how to do it:
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
HANDLE hOut;
CONSOLE_SCREEN_BUFFER_INFO SBInfo;
COORD NewSBSize;
int Status;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hOut, &SBInfo);
NewSBSize.X = SBInfo.dwSize.X - 2;
NewSBSize.Y = SBInfo.dwSize.Y;
Status = SetConsoleScreenBufferSize(hOut, NewSBSize);
if (Status == 0)
{
Status = GetLastError();
cout << "SetConsoleScreenBufferSize() failed! Reason : " << Status << endl;
exit(Status);
}
GetConsoleScreenBufferInfo(hOut, &SBInfo);
cout << "Screen Buffer Size : ";
cout << SBInfo.dwSize.X << " x ";
cout << SBInfo.dwSize.Y << endl;
return 0;
}
You need to make the console screen buffer the same size as the console window. Get the window size with GetConsoleScreenBufferInfo, srWindow member. Set the buffer size with SetConsoleScreenBufferSize().