Search This Blog

Friday 23 November 2012

How to Change the Size of output screen?

Interesting code:


#include <windows.h>

main()
{
      while(true)
      {
          Sleep(100);
          SMALL_RECT WinRect = {0, 0, rand() % 100 + 1, rand() % 70 + 1};
          SMALL_RECT* WinSize = &WinRect;
          SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE), true, WinSize);
      }
}

This code was for fun, isn't it cool?
Now execute the following code:


#include <windows.h>
main()
{
          SMALL_RECT WinRect = {0, 0, 30, 57 };// 30 is for changing screen horizontally and 57 for changing vertically.
          SMALL_RECT* WinSize = &WinRect;
          SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE), true, WinSize);
}


You can get your desired output screen by changing 30 and 57.

1 comment:

  1. Thanks for completing my request, your blog is outstanding.

    I'm loving it.

    ReplyDelete