I was creating a C++ game like console program where you can input lots of different commands and it will preform an action but I want it to be full screen and without scrollbar but still being possible to scroll up and down because some outputs are too long. So basically all I'm asking is to remove scrollbar on the right but keep the functionality.
Here's a simplified code:
#include <iostream>
#include <Windows.h>
using namespace std;
string a;
// i coppied this part from stack overflow don't dgudge me im new to this.
void remove_scrollbar(){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(handle, &info);
COORD new_size =
{
info.srWindow.Right - info.srWindow.Left + 1,
info.srWindow.Bottom - info.srWindow.Top + 1
};
SetConsoleScreenBufferSize(handle, new_size);
}
int main(){
remove_scrollbar();
cout << "Input Command : ";
cin >> a;
cout << endl;
if (a=="1"){
for (int i=1; i < 31; i++){
cout << "a lot of stuff that dont fit in one screen" << endl;
}
cout << "i want to scroll up now but i can't!" << endl;
system("pause");
}
return 0;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…