4
votes

I'm developing audio plugins that run within a host such as Cubase, and I'm looking to add High DPI support. This is problematic because all host applications that I know of declare themselves as non-high DPI aware, so all windows are scaled automatically by the DWM. I'm looking for a way to turn off DWM DPI scaling for the plugin window, even if the host itself is not DPI-aware (so it uses DWM DPI scaling for all other windows). Does anyone know if this is possible at all?

For applications that use a lot of plugins, such as audio hosts, this is a very real problem because they can't just go ahead and declare themselves as high-DPI aware: this would break all existing plugins. So unless Windows provides a solution for this, we're always stuck in 96 dpi land. Basically I think we need a solution that is more fine-grained than setting this per-process, so the host and plugins can individually declare their awareness level.

In case this currently can't be done, is there a way to contact a Microsoft engineer so it could be added to a future version of Windows?

2
Great link, but unfortunately only a few of Microsoft's products seem to participate. There's nothing for Windows in general as far as I can see.Frederik Slijkerman
DPI awareness is process-wide instead of per-window because when you call GetCursorPos(), how does the system know which window's DPI to consult? There is no window handle parameter. The problem is unsolvable.Raymond Chen
Thanks Raymond. I think coming from you this must be the definite answer. :-) If you post this as the answer, I'd accept it.Frederik Slijkerman
I expect that since the Windows 8.1 implementation is such a mess, that not even Windows 8.1's control panel supports per-monitor-DPI-awareness, without glitches aplenty, that this will all get rebuilt again in Windows 10. Oh the fun. For fun, try taking the Screen Resolution window and drag it from a 96 dpi monitor to a 150+ dpi monitor, and back again.Warren P

2 Answers

5
votes

Per window DPI awareness is now possible, since Windows 10 anniversary update. A new API SetThreadDpiAwarenessContext() can be used to set per window,and per thread DPI awareness. This is accomplished as follows.

  • A thread can now dynamically change its DPI awarensss.
  • DPI awareness of a window created by the thread will depend on the DPI awareness of the calling thread at the time windows was created.
  • When windows procedure for a window is called, the thread is automatically switched to the DPI awareness context that was in use when the window was created.

Read the following references.

2
votes

You are out of luck here. DPI awareness is a process wide setting. In Windows 8.1 you can declare the process to be DPI aware on a per monitor basis.

And as Raymond comments above, no amount of engineering would enable API functions like GetCursorPos to have per-window DPI awareness, since such functions are not passed windows.