How can I make Windows 8.1 aware that my Delphi application wants to support Per Monitor DPI?

后端 未结 3 698
攒了一身酷
攒了一身酷 2020-12-31 00:21

I have tried to make Windows 8.1 recognize a Delphi XE6 application (a demo program) that I have been trying to build, and have it recognize my application is Per-Monitor DP

3条回答
  •  旧巷少年郎
    2020-12-31 00:51

    It is documented on the MSDN topic Writing DPI-Aware Desktop and Win32 Applications:

    Mark the application as per monitor-DPI aware by modifying the application manifest or by calling the SetProcessDpiAwarenessAPI. We recommend that you use the application manifest because that sets the DPI awareness level when the application is launched. Use the API only in the following cases:

    • Your code is in a dll that runs via rundll32.exe. This is a launch mechanism that does not support the application manifest.
    • You need to make complex run-time decisions based on OS version or other considerations. For example, if you need the application to be system-DPI aware on Windows 7 and dynamically aware on Windows 8.1, use the True/PM manifest setting.

    If you use the SetProcessDpiAwareness method to set the DPI awareness level, you must call SetProcessDpiAwareness prior to any Win32API call that forces the system to begin virtualization.

    DPI awareness manifest value, Description

    False Sets the application to not DPI-aware.

    True Sets the application to system DPI–aware.

    Per-monitor On Windows 8.1, sets the application to per monitor-DPI aware. On Windows Vista through Windows 8, sets the application to not DPI–aware.

    True/PM On Windows 8.1, sets the application to per monitor-DPI aware. On Windows Vista through Windows 8, sets the application to system-DPI aware.

    You just use the standard DPI aware manifest but specify True/PM or Per-monitor instead of True.

    The same topic gives the DPI aware manifest as follows:

    
      
        
          true
        
      
    
    

    So, replace True with your chosen value.

提交回复
热议问题