How to Set Compatibility Flags for Your Application

How to Set Compatibility Flags for Your Application

Summary

This article explains how to set compatibility flags for your application in your installer by writing registry entries

Synopsis

In certain circumstances it may be necessary to set compatibility flags for the application being installed. When compatibility flags are set for an executable, this information is stored in the registry. This means that you can write the necessary registry entries at install time to set the compatibility flags.

If we look at an example executable isdev.exe which exists at C:\Program Files (x86)\InstallShield\2014\System and set the compatibility mode to 'Windows Vista' and check 'Run this program as an administrator' as shown below.

User-added image

Then you will see the following registry entry is created:

User-added image
(See attached image for large size)

As you can see a new string has been created at Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers. The name of the string is set to the full path to the executable and the string data is set to contain various values, separated with a space, based on the flags that are set for that executable.

So you can create a new registry string in your InstallShield project to set compatibility flags. Make sure the string name is the full path to your executable including the executable name. Then set the string data depending on which flags you would like to set. There is a list of some of the possible flag settings below.

User-added image
(See attached image for large size)

To apply the compatibility flags only for the current user you can create the string at

'HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers'

If you would like the flags to be set for all users you can create the string at

'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers'

Bear in mind that when setting compatibility flags using HKLM for all users, the settings cannot be changed by a user that does not have administrative rights on that machine. Also when writing to HKLM\Software, Windows Installer will automatically redirect registry information from a 32 bit MSI installer to HKLM\Software\Wow6432Node\. To write to the correct all users directory on a 64 bit machine you will need to use a 64 bit MSI and set the registry component to 64 bit also.

Additional Information

Some of the possible registry values are listed below. You can find out others by setting the compatibility options on your machine for an executable and then looking at the registry location to see what values are written.

WIN95 Windows 95
WIN98 Windows 98
WIN4SP5 Windows NT 4.0 SP5
WIN2000 Windows 2000
WINXPSP2 Windows XP SP2
WINXPSP3 Windows XP SP3
VISTARTM Vista
VISTASP1 Vista SP1
VISTASP2 Vista SP2
WIN7RTM Windows 7
WINSRV03SP1 Windows Server 2003 SP1
WINSRV08SP1 Windows Server 2008 SP1
DISABLETHEMES Disable Visual Themes
640X480 Run in 640 x 480 screen resolution
HIGHDPIAWARE Disable display scaling on high DPI settings
256COLOR Run in 256 colors
DISABLEDWM Disable Desktop Composition
RUNASADMIN Run program as an administrator
Labels (1)
Was this article helpful? Yes No
No ratings
Version history
Revision #:
1 of 1
Last update:
‎Nov 07, 2018 09:33 PM
Updated by: