Skip to content

Instantly share code, notes, and snippets.

@topher200
Created March 22, 2011 05:06
Show Gist options
  • Save topher200/880804 to your computer and use it in GitHub Desktop.
Save topher200/880804 to your computer and use it in GitHub Desktop.
In Inno Setup, figure out if we're running an upgrade or a fresh install
// Used to determine if we are running a new install or an upgrade by checking
// for the AppID in the registry.
function IsNewInstall(): Boolean;
var
AppID: String;
UninstallPath: String;
begin
AppID := '{enter-AppID-here}'
UninstallPath := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' + AppID + '_is1';
Result := not (RegKeyExists(HKEY_CURRENT_USER, UninstallPath)
OR RegKeyExists(HKEY_LOCAL_MACHINE, UninstallPath));
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment