Increasing console size?

Started by
5 comments, last by pascalosti 17 years, 8 months ago
How can I increase the size of the console window? (width)
Advertisement
- Run Cmd
- Right Click on the Title Bar
- Select Properties
- Click on the Layout Tab
- Change the Width in the Screen Buffer Size and in the Window Size.
So you cant do it when running a small console app?
Not sure what you mean by "when running a small console app". You can do the following though. Run your console app (not the cmd line), right click...(and all the rest the other guy said). When you click ok it will say "Do you wish to save this attribute for all console apps. with the same title". Or you can look up on msdn.com a function : SetConsole... something. Just look up SetConsoleCursorPosition() on msdn and it will be with a ton of functions for console apps.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

It is possible.

#include <stdlib.h>#include <Windows.h>#include <stdio.h>// Stick this at the top, after any includes, before any functionsHANDLE wHnd;    // Handle to write to the console.HANDLE rHnd;    // Handle to read from the console.void Init(){    // Set up the handles for reading/writing:    wHnd = GetStdHandle(STD_OUTPUT_HANDLE);    rHnd = GetStdHandle(STD_INPUT_HANDLE);}void SetWndSize(int Left, int Top, int Right, int Bottom){    SBS_RESETX = Right + 1;    SBS_RESETY = Bottom + 1;    // Set up the required window size:    SMALL_RECT windowSize = {Left, Top, Right, Bottom};    // Change the console window size:    SetConsoleWindowInfo(wHnd, TRUE, &windowSize);}int main(){     Init();     SetWndSize(20, 20, 20, 20); // reset these according to the above func.     // ... Your code here}


I dug that out from a while back when I was still making console games. Hope it works for you.

EDIT: Fixed the source... I just tested the previous stuff and it seemed a little glitched.
The best thing to do is just choose whatever you think you'd prefer, and go for it. -Promit
You can. See the documentation for the Windows console API. You may have to destroy and recreate the console window to achieve your goal.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
excellent that should work!

thank you

This topic is closed to new replies.

Advertisement