-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisversion.iss
57 lines (55 loc) · 1.9 KB
/
isversion.iss
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
// -- IsVersion.iss --
// Include file with support functions for version check
//
[CustomMessages]
english.UninstallOldVersion=Version %1 of {#AppName} is already installed. It has be uninstalled before.
french.UninstallOldVersion=La version %1 de {#AppName} est déjà installée. Elle doit être désinstallée.
english.UninstallFailed=Failed to uninstall {#AppName} version %1. Please restart Windows and run setup again.
french.UninstallFailed=Impossible de désinstaller {#AppName} version %1. Merci de redémarrer Windows et de relancer l'installation.
[Code]
<event('NextButtonClick')>
function NextButtonClick2(CurPageID: Integer): Boolean;
var
oldVersion: String;
uninstaller: String;
ErrorCode: Integer;
begin
if (CurPageID = wpSelectComponents) and WizardIsComponentSelected('portable') then
begin
if RegKeyExists(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppID}_is1') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppID}_is1',
'DisplayVersion', oldVersion);
if MsgBox(FmtMessage(CustomMessage('UninstallOldVersion'), [oldVersion]), mbConfirmation, MB_OKCANCEL) = IDOK then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppID}_is1',
'UninstallString', uninstaller);
ShellExec('runas', uninstaller, '/SILENT', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
if (ErrorCode <> 0) then
begin
MsgBox(CustomMessage('UninstallFailed}'), mbError, MB_OK );
Result := False;
end
else
begin
Result := True;
end;
end
else
begin
Result := False;
end;
end
else
begin
Result := True;
end;
end
else
begin
Result := true;
end;
end;