Detected webview runtime already installed ,but run webview runtime installer always

101 views
Skip to first unread message

nuoya pan

unread,
Mar 18, 2022, 5:23:34 AM3/18/22
to innosetup
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;

Laurent Combémorel

unread,
Mar 18, 2022, 1:41:58 PM3/18/22
to innosetup
if the result of the check function is true, then the entry is ran. If you don't want it to run, return false!

nuoya pan

unread,
Mar 18, 2022, 10:23:02 PM3/18/22
to innosetup
I have try to return false,but the entry still run....

nuoya pan

unread,
Mar 18, 2022, 10:31:22 PM3/18/22
to innosetup
It's all my fault,I try to reture false,it's worked,Thanks a lot!
在2022年3月19日星期六 UTC+8 01:41:58<Laurent Combémorel> 写道:
Reply all
Reply to author
Forward
0 new messages