If you change the DPI of your machine from 100% to any other higher value, your desktop applications may appear somewhat blurry when you compare them with other applications on the screen. Alternately, display problems may exist such as truncated text.
In order to fix this issue, you would need to Disable DPI virtualization for the application. To do this, right-click the application’s shortcut and then click Properties. On the Compatibility tab, select Disable Display Scaling on High DPI Settings, and then click OK.
Alternatively, you may also disable this setting using the below Registry keys.
Registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
String: “Path to your application exe”
Value: ~ HIGHDPIAWARE
Please note there is a space between ‘tilde’ and ‘HIGHDPIAWARE’.
There are number of ways to set a value in the registry. Below steps will show the process to set this value in registry using Inno setup:
var
str_MyAppFullExePath: String;
str_MyAppFullExePath := ExpandConstant('{app}') ;
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers', str_MyAppFullExePath + '\' + '{#MyAppExeName}' , '~ HIGHDPIAWARE');
Possible Issues:
If your application is 32 bit, then the above command will set the value at
In order to fix this issue, you would need to Disable DPI virtualization for the application. To do this, right-click the application’s shortcut and then click Properties. On the Compatibility tab, select Disable Display Scaling on High DPI Settings, and then click OK.
Alternatively, you may also disable this setting using the below Registry keys.
Registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
String: “Path to your application exe”
Value: ~ HIGHDPIAWARE
Please note there is a space between ‘tilde’ and ‘HIGHDPIAWARE’.
There are number of ways to set a value in the registry. Below steps will show the process to set this value in registry using Inno setup:
var
str_MyAppFullExePath: String;
str_MyAppFullExePath := ExpandConstant('{app}') ;
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers', str_MyAppFullExePath + '\' + '{#MyAppExeName}' , '~ HIGHDPIAWARE');
Possible Issues:
If your application is 32 bit, then the above command will set the value at
“HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers”
instead of
“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers”.
This will not set the “Disable Display Scaling on High DPI Settings” property. This can be fixed by using the below command:
if IsWin64 then
begin
else
begin
It will force the setup to store value in 64 bit registry.
if IsWin64 then
begin
RegWriteStringValue(HKLM64, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers', str_MyAppFullExePath + '\' + '{#MyAppExeName}' , '~ HIGHDPIAWARE');end
else
begin
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers', str_MyAppFullExePath + '\' + '{#MyAppExeName}' , '~ HIGHDPIAWARE');end ;
It will force the setup to store value in 64 bit registry.
This article is a gem! I appreciate the detailed research you put into it. It’s refreshing to see such thoroughness!
ReplyDeleteNinza Host Is platform par, aap development tools ka istemal kar ke apni applications ko adapt kar sakte hain, jo user experience ko enhance karne mein madadgar hota hai.
ReplyDelete