[try Beta version]
Not logged in

 
Resize console window

Dec 24, 2008 at 12:39pm
Ok, so I am trying to resize my console window so it can fit my program better. I found this website: http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles6.html which seemed to work rather well. I spent some time trying to understand what each function did and once I thought I had a handle on it I tried utilizing it for myself. For whatever reason, my console does not resize. When I compiled the code that this website provided it worked however nothing quite met my needs so I tried to adapt it. Can someone please look at my code and see what they think I am doing wrong?

1
2
3
4
5
6
7
8
9
10
11
12
void resize()
{
    HANDLE thisProgram;
    SMALL_RECT DisplayArea = {0,0,0,0};
    
    thisProgram = GetStdHandle(STD_OUTPUT_HANDLE);
    
    // This should set where the bottom of the console winow is but
    // it doesn't seem to be working and I cannot figure out why.
    DisplayArea.Bottom = 500;        
    SetConsoleWindowInfo(thisProgram, TRUE, &DisplayArea);
}
Dec 24, 2008 at 12:54pm
Nevermind! I figured it out... the size I was trying to resize to was invalid thus the function SetConsoleWindowInfo() was failing.
Dec 25, 2008 at 8:31am
Be reminded that the window size cannot be larger than the screen buffer size. Always resize together with the function, SetConsoleScreeBufferSize()
Topic archived. No new replies allowed.