Search code examples
c++visual-studiopremake

How can I change dpi manifest settings in a premake VS C++ project?


Currently, I call SetProcessDPIAware() but the docs recommend using a manifest:

We recommended that you specify the default process DPI awareness via a manifest setting. While specifying the default via API is supported, it is not recommended.

Additionally, I find that on some machines calling SetProcessDPIAware() causes the window title to disappear and reappear which causes the window to move down. I'm trying to have a persistent window position and this flicker is making my window slide down the screen after repeated runs.

How do I set dpi settings in the manifest in Visual Studio? How would I make premake generate a vcxproj with that setting?

How to run correctly with a high DPI setting? describes some of the answer I'm looking for, but the menus are different for C#.


Solution

  • To change in Visual Studio:

    1. Open properties for the Startup Project
    2. Manifest Tool > Input and Output
    3. Change DPI Awareness to Per Monitor High DPI Aware

    To change in premake, set dpiawareness inside your project block:

    project( "ProjectName" )
        kind "WindowedApp"
    
        dpiawareness "HighPerMonitor"