C++ Console : Full Screen

     As soon as i grasped on programming, i felt like it was too boring to run programs in console where black and white and small screen is strictly applied on my head and i have to just go with it. But software is not a name of limit or stopping. It is meant to create anything which is not even possible in real world. So today i'm sharing with you a simple code which you can save and use in various C++ projects you can also visit this post where you can see how console is colored so that you can achieve some basic level of satisfaction.

 #include <iostream>  
 #include <Windows.h>  
 using namespace std;  
 HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);  
 void fullscreen();  
 void main(){  
  fullscreen();  
  cout << "Console is now in full screen size" << endl;  
  system("pause");  
 }  
 void fullscreen(){  
  COORD NewSBSize = GetLargestConsoleWindowSize(out);  
  NewSBSize.Y += 3;  
  NewSBSize.X -= 2;  
  SMALL_RECT DisplayArea = { 0, 0, 0, 0 };  
  SetConsoleScreenBufferSize(out, NewSBSize);  
  DisplayArea.Right = NewSBSize.X - 1;  
  DisplayArea.Bottom = NewSBSize.Y - 1;  
  SetConsoleWindowInfo(out, TRUE, &DisplayArea);  
 }  
Here are some useful links you can see for other cool stuff that you can do in C++ console: (coming soon)

  • Colors in console
  • Change font size of console (useful in creating symmetrical graphic shapes)
  • Play sounds in C++
  • Get mouse input in C++

Comments

Popular posts from this blog

C++ Console : Basic Graphic Techniques

C++ Console : Change Font Size

C++ Console : Color