I have a WPF application hosting winforms controls. When I run the application in Windows 8.1. The Ui is cluttered. As a work around I am changing the system DPi and resolution settings. How ever what I want is to make the application's dpiaware as false. From my research I know that I can use the manifest or use an api setdpiawareness from shcore.dll(win8.1). The manifest is more suitable to me. I have checked Disable DPI awareness for WPF application .
My query is more with respect to manifest , I am writing a sample application to make dpiaware as false. I have already embed the manifest, below is what it looks like.
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>false</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
I am trying to run the below and every time the value of Dpiaware is true. Any thing that I am doing wrong in the manifest? or any alternatives?
[DllImport("user32.dll", SetLastError = true)]
static extern bool IsProcessDPIAware();
protected override void OnStartup(StartupEventArgs e)
{
Process_DPI_Awareness p;
p = 0;
base.OnStartup(e);
bool h = IsProcessDPIAware();
if(h)
MessageBox.Show("Dpi is 1");
else
MessageBox.Show("Dpi is not true");
}