Question

Currently I have an c++ console application running on Win7/AIX/Linux. In the application I use getmaxyx to get the dimensions of the window.

getmaxyx(_window, _rows, _cols);

On the windows platform i need to play around with the (properties)(layout) options of the running app, to get the screen maximized. That is a bit of a pain.

Thumbing through the documention yields nothing of value.

lines:  Specifies the number of lines the "screen" will have.
               Directly equates to LINES.
               There is no theoretical maximum.
               The minimum value must be 2.
               Default: 24
cols:   Specifies the number of columns the "screen" will have.
               Directly equates to COLS.
               There is no theoretical maximum.
               The minimum value must be 2.
               Default: 80

Is there any technique that I can use to cause the window to be resized to the physical size of the screen? Is there a portable way using PDCurses, and curses? If not, are there any platform specific ways to implement this behavior?

Possibly Related SO Question

Here perl does it with signals

Was it helpful?

Solution

        /* Resize the terminal to something larger than the physical screen */
        resize_term(2000, 2000);

        /* Get the largest physical screen dimensions */
        getmaxyx(_window, _rows, _cols);

        /* Resize so it fits */
        resize_term(_rows - 1, _cols - 1);

        /* Get the screen dimensions that fit */
        getmaxyx(_window, _rows, _cols);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top