How do you "force" screen size.

Jun 17, 2010 at 2:20pm
I'm using Visual Studio C++ and I want to control the size of the window when my code (console app) runs. I can do that on my home computer, but when I send my .exe file to someone else to run, it starts out very small. Is there something I can put in my code to keep the size of the window consistant (as big as possible).

Thanks.
Jun 17, 2010 at 2:32pm
If you don't mind it being windows-only, you can try SetConsoleWindowInfo:

http://msdn.microsoft.com/en-us/library/ms686125(VS.85).aspx

Although it sounds to me like you are misusing the console. Why would you need to do something like this?
Last edited on Jun 17, 2010 at 2:33pm
Jun 17, 2010 at 3:20pm
http://www.adrianxw.dk/SoftwareSite/index.html

Check out part 6 of "Working with the Widows Console".
Jun 17, 2010 at 3:38pm
Thanks, I'll try that.

As far as why: I make "educational" games for elementary students. Little kids (3-5th graders) don't know how to manipulate the windows size and when the game pops up in a small window, they flip out a little.
Jun 19, 2010 at 3:11pm
I got the console app window to fill the screen using:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
    HANDLE hOut;
    COORD NewSBSize;
    SMALL_RECT DisplayArea = {0, 0, 0, 0};

    hOut = GetStdHandle(STD_OUTPUT_HANDLE);

    NewSBSize = GetLargestConsoleWindowSize(hOut);

    SetConsoleScreenBufferSize(hOut,NewSBSize);

    DisplayArea.Right = NewSBSize.X - 1;
    DisplayArea.Bottom = NewSBSize.Y - 1;

    SetConsoleWindowInfo(hOut,TRUE,&DisplayArea);


but the program I've written doesn't fill the window.

Instead it appears small in the top righthand corner.

Any suggestions???
Topic archived. No new replies allowed.