Sign in to follow this  
Felon_pro

full screen console apps in standard c++

Recommended Posts

Felon_pro    100
the subject talked. I worked and compiled programs in code::blocks. These .exe's do not have full screen modes in them! how do i get them to work full screen?even properties of these exe's do not have full screen modes in them. (right click -> properties). what do i do to enable full screen?

Share this post


Link to post
Share on other sites
Jaywalk    250
You say you want to run console exes in fullscreen mode, right. When a console program is running (in the foreground), pressing the Enter key while holding down the Alt key toggles between fullscreen and window mode.

Share this post


Link to post
Share on other sites
Jaywalk    250
I don't think that there's a way to configure a single console app to default to fullscreen as opposed to window mode (since console apps have no concept of a window), but if you make a shortcut to the app then you can configure the shortcut to run in fullscreen mode. This is in the "Options" tab of the shortcut's propies.

Share this post


Link to post
Share on other sites
TheUnbeliever    963
You can't (in standard C++, see below).

The closest you can come is doing the following:
While your app is running in windowed mode, click the window icon in the top left, then click properties. Change "Display Properties" to "Full Screen". You can choose to have this apply to all future windows with the same title. However, this applies only on your system and won't happen elsewhere.

This is logical if you think about it, because the 'console' needn't necessarily be a window or anything like it (it could be having input sent over a serial connection with output to a teletype) - so it won't be standard C++ (there may well be a Microsoft API call you can make, however).

Share this post


Link to post
Share on other sites
rip-off    10976
It is useful, but standard c++ has no concept of consoles.

On most pcs c++'s cin and cout are linked to console input and output, but they dont have to be.

What you need to find is a library of functions that act on consoles. Most operating systems will have a console API, but I'm sure that there are cross-platform console libraries available.

I don't know of any as I don't usually make console programs.

Share this post


Link to post
Share on other sites
Thunder Sky    144
Hi, as stated before you wont have any luck finding anything in the standard. But the Win32 API should have something (asuming your on Windows). Even if it doesnt have a "GoToFullscreen" function you probably could check if the console had keyboard focus and then send a Alt+Enter command to the operating system and let it handle the rest. I guess for checking if the console is in focus you have to have some sort of handle to it, you can get a HWND by doing this (this is more or less a copy-paste from somewhere, cant remember where now, buts its pretty straight forward so I hope the author wont mind).

HWND GetConsoleHwnd(void) {
HWND hwndFound;
char pszNewWindowTitle[1024];
char pszOldWindowTitle[1024];

GetConsoleTitle(pszOldWindowTitle, 1024);
wsprintf(pszNewWindowTitle,"%d/%d",GetTickCount(),GetCurrentProcessId());
SetConsoleTitle(pszNewWindowTitle);
Sleep(40);
hwndFound=FindWindow(NULL, pszNewWindowTitle);
SetConsoleTitle(pszOldWindowTitle);
return(hwndFound);
};

As for sending the keyboard commands..I have no clue, but MSDN should have all the info you need

Its been a while since I did any console apps, sorry I coulnd give you a more koncrete solution. Also, I would be happy if you could post your solution to this, if you find one.

Thunder Sky

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this