we are embedding a .net visual plugin (written in C# using WPF) in a Delphi host application (written in Delphi 2007). We are using Hydra version 4.4.67.
In Windows 10 (or 8.1), every process must declare its DPI awareness. While the Delphi application is DPI unaware, every application using WPF seems to be DPI aware by default.
The problem: when the system-wide text size factor is set to any value higher than 100%, the moment the plugin is shown inside the host, all the windows of the host are suddenly shrinked. The reason for this seems to be that the plugin declares the process as DPI aware, so the system suspends all the scaling.
We have tried to disable the DPI awareness of the plugin (by setting “[assembly: System.Windows.Media.DisableDpiAwareness]” in the assemby info of the plugin project, or by calling SetProcessDpiAwareness()), but nothing has any effect. (It works for standalone WPF applications, but not for DLLs.)
How can we solve this problem? Is there a way in Hydra to declare a plugin as DPI unaware?
The reason for the problem seems to be that at some point during the initialization of the plugin there is a call to the API function “SetProcessDpiAware” (the predecessor of “SetProcessDpiAwareness”), which causes the system to suspend scaling for the whole process, i.e. not only for the plugin but also for the host.
I solved the problem by blocking this API call using the method described here:
We tried to customize the manifest file, but the application still switched to DPI aware as soon as the plugin was shown.
I did not try to call “SetProcessDpiAwareness” in the host, as I found another solution (described in the post below) which simply blocks the switching of the DPI awareness.