本文介绍了如何删除控制台窗口C ++滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经查看了用C和C ++编写的一些(Larn,Rogue等) ,我注意到他们没有在控制台窗口右边的滚动条。
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.
如何完成这个功能?
推荐答案
演示如何做:
#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;
}
这篇关于如何删除控制台窗口C ++滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!