CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Location
    England
    Posts
    57

    [RESOLVED] Largest Console window supported?

    I am having issues with establishing the largest console window supported on my system. I have written this code:

    Code:
    void vmApp::GetMaxConsoleAppSize()
    {
        COORD maxConsoleSize;
    
    
        maxConsoleSize = GetLargestConsoleWindowSize(m_hStdOut);
        cout << "X = " << maxConsoleSize.X << " Y = " << maxConsoleSize.Y << endl;
    
    
        m_nMaxAppWidth = maxConsoleSize.X;
        m_nMaxAppHeight = maxConsoleSize.Y;
    }
    This reports X = 170 Y = 59 on my system. Issue here is that if I open a dos window (CMD), I am able to open the properties of that window and adjust the window size beyond what my method reports? How can I achieve this?
    What the mind can conceive it can achieve.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: Largest Console window supported?

    Console, properties, layout, window size will allow you to set the width and height to any value you want. However, if you set a value for the window size larger than the values returned from GetLargestConsoleWindowSize(), then the window size is only adjusted to the largest console window size. If you save the values in properties and then go back to properties, layout you will see that the values have been set to the largest possible size and are not now the values you entered.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Jan 2009
    Location
    England
    Posts
    57

    Re: Largest Console window supported?

    My apologies, this method is returning the correct values. I was playing around with the screen buffer. Thanks for your reply.
    What the mind can conceive it can achieve.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured