1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#define MyAppName "Zombiland"
#define MyAppVersion "1.1.1"
#define MyApp "Zombiland"
#define MyAppId "{198F01BC-E3B2-4421-BE4E-E3671A9E7AC2}"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyApp}
AppId={{#MyAppId}
[Code]
const
OldVersionRegKey = '\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppId}_is1';
var
HasOldVersion : boolean;
OldVersionDisplayVersion : string;
OldVersionInstallDir : string;
OldVersionUninstallString : string;
function OldVersionInfo(Param : string) : string;
begin
if Param = 'version' then
Result := OldVersionDisplayVersion
else if Param = 'installdir' then
Result := OldVersionInstallDir
else if Param = 'uninstallstring' then
Result := OldVersionUninstallString
else
Result := '';
end;
function GetKey : Integer;
begin
if IsWin64 then
Result := HKLM64
else
Result := HKLM32;
end;
procedure CheckOldVersion;
begin
HasOldVersion := RegKeyExists(GetKey, OldVersionRegKey);
OldVersionDisplayVersion := '';
OldVersionInstallDir := '';
OldVersionUninstallString := '';
if HasOldVersion then
begin
RegQueryStringValue(GetKey, OldVersionRegKey, 'DisplayVersion', OldVersionDisplayVersion);
RegQueryStringValue(GetKey, OldVersionRegKey, 'InstallLocation', OldVersionInstallDir);
RegQueryStringValue(GetKey, OldVersionRegKey, 'QuietUninstallString', OldVersionUninstallString);
end;
end;
{*** INITIALISATION ***}
Procedure InitializeWizard;
begin
MsgBox('Id Exist : ' + IntToStr(Integer(HasOldVersion)), mbInformation, MB_OK);
MsgBox('Id : ' + OldVersionRegKey, mbInformation, MB_OK);
MsgBox('Version : ' + OldVersionInfo('version'), mbInformation, MB_OK);
MsgBox('Install Dir : ' + OldVersionInfo('installdir'), mbInformation, MB_OK);
MsgBox('Uninstall String : ' + OldVersionInfo('uninstallstring'), mbInformation, MB_OK);
end; |
Partager