【问题标题】:Difference between MFC and windows API in getting screen resolution [duplicate]MFC和Windows API在获取屏幕分辨率方面的区别[重复]
【发布时间】:2016-12-06 15:08:33
【问题描述】:

我将 Windows 屏幕分辨率设置为 1920x1080。 我有 c++ windows API 程序,需要使用GetSystemMetrics 函数。

int x = GetSystemMetrics(SM_CXSCREEN);//retun x=1536
int y = GetSystemMetrics(SM_CYSCREEN);//retun y=864

如您所见,我得到的值与 1920x1080 不同。 但是如果我在程序设置中使用MFC headers (afx.h) 并使用MFC dlls,那么返回值x,y 等于windows 屏幕分辨率( 1920x1080)。

为什么这两种方法不一样?

如何在不使用 MFC 的情况下在我的程序中获得正确的 Windows 屏幕分辨率?

【问题讨论】:

    标签: c++ winapi mfc screen-resolution


    【解决方案1】:

    您是否有可能在 125% 缩放的 Windows 上运行?因为 1,25 * 1536 = 1920 和 1,25 * 864 = 1080?我假设 MFC 不支持 DPI。

    另外,请参阅this,了解如何将您的应用程序标记为 DPI 感知。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多