#cs---------------------------------------------------------------------------------------------- Run a program with compatibility mode Online resource: http://www.autoitscript.com/forum/topic/24969-run-a-app-in-compatibility-mode/ Modified by: Zhipeng Tian Modified on: 6/20/12 Usage Example: 30000077395196.au3 #ce---------------------------------------------------------------------------------------------- $exePath = "Path to Exe" ;Important!!!: regPath is different from exePath if runs in virtual machine ;check it by setting compatibility mode manually and then ;look up "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" in registry $regPath = "Path for Windows Registry" $check = _SetCompat($exePath) ; Addtional parameter "$regPath" is required for virtual machine!!! If @error == 1 Then MsgBox(0,"Error", "Incorrect Operating System Version.") ElseIf @error == 2 Then MsgBox(0,"Error", "Path to .exe file does not exist.") EndIf Run($exePath) Func _SetCompat($exePath, $regPath = $exePath, $OS_Version = "", $256_Mode = 0, $640_480_Mode = 0, $Disable_Themes = 0, $Disable_Adv_Text = 0) $regString = "" Select Case StringInStr($OS_Version, "95") $regString &= "WIN95 " Case StringInStr($OS_Version, "98") Or StringInStr($OS_Version, "ME") $regString &= "WIN98 " Case StringInStr($OS_Version, "NT") $regString &= "NT4SP5 " Case StringInStr($OS_Version, "2000") $regString &= "WIN2000 " Case $OS_Version <> "" SetError(1) Return 0; Incorrect OS Version EndSelect If $256_Mode <> 0 Then $regString &= "256COLOR " EndIf If $640_480_Mode <> 0 Then $regString &= "640X480 " EndIf If $Disable_Themes <> 0 Then $regString &= "DISABLETHEMES " EndIf If $Disable_Adv_Text <> 0 Then $regString &= "DISABLECICERO " EndIf If StringRight($regString, 1) == " " Then $regString = StringTrimRight($regString, 1) EndIf If FileExists($exePath) Then RegWrite("HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", $regPath, "REG_SZ", $regString) Return 1; Success Else SetError(2) Return 0; EXE file does not exist EndIf EndFunc