The check function reture true,I can get messagebox with "do not need install webview2",but the webview installer always run.When I add "Parameters: /q" after check funciton WebViewRunTimeinstalled, webview installer will be broken with error.Here is sniper code.
[Run]
Filename: "{app}\{#VCFile}";Check:VCinstalled;WorkingDir: {tmp}; Flags: skipifsilent
Filename: "{app}\{#WebViewFile}"; Check:WebViewRunTimeinstalled; WorkingDir: {tmp}; Flags: skipifsilent
Filename: "{app}\{#PrinterDriver}"; Parameters: /q; WorkingDir: {tmp}; Flags: skipifsilent
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppExeName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Code]
function WebViewRunTimeinstalled(): Boolean;
var
key1: String;
key2: String;
version1: String;
version2: String;
begin
Result := false;
if IsWin64 then begin
key1 := 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}';
key2 := 'Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}';
if RegQueryStringValue(HKLM64, key1, 'pv', version1) then
Result := trim(version1) <>'';
MsgBox('version:'+version1,mbInformation,MB_OK);
end;
if not Result then begin
if RegQueryStringValue(HKCU64, key2, 'pv', version2) then begin
Result := trim(version2) <> '';
end
else begin
MsgBox('read key2 failure',mbInformation,MB_OK);
end;
end;
if result then
MsgBox('do not need install webview2', mbConfirmation, MB_OK);
end;