Jump to content
  • Advertisement
Sign in to follow this  
pascalosti

Increasing console size?

This topic is 4427 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
It is possible.


#include <stdlib.h>
#include <Windows.h>
#include <stdio.h>
// Stick this at the top, after any includes, before any functions
HANDLE 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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!