How detect current screen resolution?

前端 未结 7 1076
悲哀的现实
悲哀的现实 2020-11-27 04:00

How do I from Winapi (in C or C++) detect the current screen resolution?

Some background:

I want to start a new OpenGL fullscreen window, but want it open wi

7条回答
  •  Happy的楠姐
    2020-11-27 04:31

    When system use DPI virtualization (Vista and above) using GetSystemMetrics or GetWindowRect will fail to get the real screen resolution (you will get the virtual resolution) unless you created DPI Aware Application.

    So the best option here (simple and backward compatible) is to use EnumDisplaySettings with ENUM_CURRENT_SETTINGS.

提交回复
热议问题