VC 如图:如何获取更改文本、应用和其他项目的大小,150%数字

解决方案 »

  1.   

    提问前请先搜索
    https://msdn.microsoft.com/windows/hardware/commercialize/manufacture/desktop/dpi-related-apis-and-registry-settings
      

  2.   

    float  GetScreenZoomScaleWidth()
    {
    float dbZoomScale = 1.0; HDC desktopDc = CreateDC(_T("display"), NULL, NULL, NULL);
    // Get native resolution
    int horizontalDPI = GetDeviceCaps( desktopDc, LOGPIXELSX ); dbZoomScale = horizontalDPI / 96.0f; return dbZoomScale;
    }float  GetScreenZoomScaleHeight()
    {
    float dbZoomScale = 1.0; HDC desktopDc = CreateDC(_T("display"), NULL, NULL, NULL);
    // Get native resolution
    int verticalDPI = GetDeviceCaps( desktopDc, LOGPIXELSY ); dbZoomScale = verticalDPI / 96.0f; return dbZoomScale;
    }我把显示器设置成150%,调用这两个函数,得到的还是96,重启机器也不行,查注册表,发现注册中还是96,请问有什么办法能解决,得到正确的值吗?