Do not show message box to confirm uninstallation of old install when /VERYSILENT switch specified.

This commit is contained in:
dolphin6k 2022-01-11 15:47:59 +09:00
parent c67dfbc562
commit 4a70b008c1

View file

@ -255,6 +255,19 @@ begin
Result := Path; Result := Path;
end; end;
function CmdLineParamExists(const Value: string): Boolean;
var
I: Integer;
begin
Result := False;
for I := 1 to ParamCount do
if CompareText(ParamStr(I), Value) = 0 then
begin
Result := True;
Exit;
end;
end;
Procedure ForceUninstallPreviousX86Install(); Procedure ForceUninstallPreviousX86Install();
var var
ResultCode: Integer; ResultCode: Integer;
@ -263,12 +276,18 @@ begin
begin begin
if FileExists('C:\Program Files (x86)\TuxPaint\unins000.exe') then if FileExists('C:\Program Files (x86)\TuxPaint\unins000.exe') then
begin begin
if MsgBox('Old version will be uninstalled automatically.', mbInformation, MB_OKCANCEL) = IDOK then if CmdLineParamExists('/VERYSILENT') = False then
begin begin
Exec('C:\Program Files (x86)\TuxPaint\unins000.exe', '/SILENT', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); if MsgBox('Old version will be uninstalled automatically.', mbInformation, MB_OKCANCEL) = IDOK then
begin
Exec('C:\Program Files (x86)\TuxPaint\unins000.exe', '/SILENT', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end
else begin
Abort;
end;
end end
else begin else begin
Abort; Exec('C:\Program Files (x86)\TuxPaint\unins000.exe', '/VERYSILENT', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end; end;
end; end;
end; end;