Search code examples
c#.netwindows-10dpidpi-aware

Windows 10: SetProcessDpiAwareness has no effect


My Operating System is Windows 10 Enterprise.

[assembly: DisableDpiAwareness] is set in AssemblyInfo.cs

I am setting SetProcessDpiAwareness() to PROCESS_PER_MONITOR_DPI_AWARE = 2 and get S_OK = 0 back.

After that I call GetProcessDpiAwareness() and get PROCESS_DPI_UNAWARE = 0 back.

Why is GetProcessDpiAwareness() PROCESS_DPI_UNAWARE and why is my process not responding to DPI calls? How can I debug this issue?


Solution

  • The problem was that SetProcessDpiAwareness() needs to be called before any Win32-action. I had a toast notification window open before calling it.