Erik
Erik

Reputation: 12140

Resize windows console to fullscreen in C

Is it possible to resize the console in a windows console application to fullscreen size?

It is possible to do that in the preferences of the windows, after the console was opened, but I cannot figure out how to do it programmatically.

Upvotes: 1

Views: 3957

Answers (1)

Eric Petroelje
Eric Petroelje

Reputation: 60498

You can get a handle to the console window using GetConsoleWindow.

Once you have that, you should be able to resize it using SetWindowPos

You may also need to resize the buffer for the console using SetConsoleScreenBufferSize prior to resizing the window.

ETA:

Others have mentioned using SetConsoleDisplayMode to display the console in full-screen (non-windowed) mode. I'm not sure if this is really what you wanted or not though. I haven't seen any apps use non-windowed mode since the windows 98 days.

Upvotes: 4

Related Questions