我一直在查看用C和C编写的一些
Rogue like games(Larn,Rogue等),我注意到它们没有控制台窗口右侧的滚动条.
我怎样才能完成同样的功能?
解决方法
These guys展示了如何做到:
#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; }