0

I am trying to find a solution to launch a window as a function of the size of the screen. I know there is the method resize() of the Gtk::Window but it is only pixels and not percent that's the problem.

Thank you !

Piotr Skotnicki
  • 46,953
  • 7
  • 118
  • 160
  • Get the screen resolution [described here](http://stackoverflow.com/questions/4631292/how-detect-current-screen-resolution) and resize it with those values. – izlin Dec 21 '16 at 10:18
  • it won't work because gtkmm 3 is not compatible with OpenGL – Bill Hugues Dec 21 '16 at 10:35

1 Answers1

0

You can get the screen width and height in pixels in a quick and dirty way like this:

#include <Windows.h>    // Need this to get the screen resolution.

// Get the horizontal and vertical screen sizes in pixels:
static void GetDesktopResolution(int& horizontal, int& vertical) {
    SetProcessDPIAware();

    horizontal = GetSystemMetrics(SM_CXVIRTUALSCREEN);
    vertical =   GetSystemMetrics(SM_CYVIRTUALSCREEN);
}

For more advanced functionality, like dealing with multiple monitors, check out the link from the first comment on your question. The answers there are not just for OpenGL.