Installer: Refactor url opening

This commit is contained in:
Nodir Temirkhodjaev 2023-12-24 13:47:02 +03:00
parent 74f6f05b86
commit d641d4596a

View File

@ -125,9 +125,9 @@ begin
Result := ActiveLanguage; Result := ActiveLanguage;
end; end;
function GetUninstallString(): string; function GetUninstallString(): String;
var var
UninstallKey: string; UninstallKey: String;
begin begin
UninstallKey := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppName")}_is1'); UninstallKey := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppName")}_is1');
if not RegQueryStringValue(HKLM, UninstallKey, 'UninstallString', Result) then if not RegQueryStringValue(HKLM, UninstallKey, 'UninstallString', Result) then
@ -320,6 +320,13 @@ begin
Result := True; Result := True;
end; end;
function OpenUrl(Url: String): Boolean;
var
ErrCode: Integer;
begin
Result := ShellExec('open', Url, '', '', SW_SHOW, ewNoWait, ErrCode);
end;
function InitializeSetup: Boolean; function InitializeSetup: Boolean;
begin begin
if Unpack() then if Unpack() then
@ -350,12 +357,9 @@ begin
end; end;
#else #else
if not VCRedist86Exists() then if not VCRedist86Exists() then
var
ErrorCode: Integer;
begin begin
if SuppressibleMsgBox('{cm:InstallVCRedist}', mbCriticalError, MB_OKCANCEL, IDCANCEL) = IDOK then if SuppressibleMsgBox(ExpandConstant('{cm:InstallVCRedist}'), mbCriticalError, MB_OKCANCEL, IDCANCEL) = IDOK then
ShellExec('open', 'https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads', OpenUrl('https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads');
'', '', SW_SHOW, ewNoWait, ErrCode);
Result := False; Result := False;
Exit; Exit;