Console window size in c++ for VS19.

Keith Lovell 61 Reputation points
2020-09-10T03:46:22.047+00:00

I am developing a c++ console application and would like to increase the size of the default console window that is produced by c++ under vs19. If it is possible, how would that be achieved?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,527 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
964 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. WayneAKing 4,921 Reputation points
    2020-09-10T05:44:17.403+00:00

    It's a little more involved than you might expect.
    Start by reading this thread:

    Console: how change window size?
    https://social.msdn.microsoft.com/Forums/en-US/0de248af-3497-4537-bb41-6d129b04fb27/console-how-change-window-size

    • Wayne

  2. Anna Xiu-MSFT 25,626 Reputation points Microsoft Vendor
    2020-09-10T06:15:02.74+00:00

    Hi KeithLovell,

    Please view the similar issue and have a try with the following steps:

    1. Right-click on the title bar of Console Window;
    2. Select Properties;
    3. Navigate to Layout;
    4. Set the Window Size and click on OK;

    If there is something wrong, please feel free to contact us.

    Best regards,
    Anna


  3. RLWA32 40,286 Reputation points
    2020-09-14T01:05:57.8+00:00

    Give this a try to change the console colors -

     #include <Windows.h>
     #include <stdio.h>
    
     int main() {
     CONSOLE_SCREEN_BUFFER_INFOEX csbi{ sizeof csbi };
    
     HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    
     GetConsoleScreenBufferInfoEx(hOutput, &csbi);
    
     csbi.wAttributes = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY;
    
     SetConsoleScreenBufferInfoEx(hOutput, &csbi);
    
     printf("Text to Console\n");
    
     return 0;
     }
    
    0 comments No comments