Skip to content

Commit

Permalink
Added workaround for issue #73: WebView2 initialization failure
Browse files Browse the repository at this point in the history
  • Loading branch information
salvadordf committed Nov 29, 2024
1 parent 961e742 commit 3b4a20f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion source/uWVLoader.pas
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ TWVLoader = class(TComponent, IWVLoaderEvents)

FAutoAcceptCamAndMicCapture : boolean;

function GetInternalAvailableBrowserVersion : wvstring;
function GetAvailableBrowserVersion : wvstring;
function GetAvailableBrowserVersionWithOptions : wvstring;
function GetInitialized : boolean;
Expand Down Expand Up @@ -1251,7 +1252,8 @@ function TWVLoader.CheckBrowserExecPath : boolean;
if (length(FBrowserExecPath) = 0) then
begin
if (length(InstalledRuntimeVersion) > 0) or
SearchInstalledProgram('WebView2 Runtime', 'Microsoft Corporation') then
SearchInstalledProgram('WebView2 Runtime', 'Microsoft Corporation') or
(length(GetInternalAvailableBrowserVersion) > 0) then
Result := True
else
begin
Expand Down Expand Up @@ -1976,6 +1978,21 @@ function TWVLoader.GetAvailableBrowserVersion : wvstring;
end;
end;

function TWVLoader.GetInternalAvailableBrowserVersion : wvstring;
var
TempVersion : PWideChar;
begin
Result := '';
TempVersion := nil;

if succeeded(Internal_GetAvailableCoreWebView2BrowserVersionString(PWideChar(FBrowserExecPath), @TempVersion)) and
assigned(TempVersion) then
begin
Result := TempVersion;
CoTaskMemFree(TempVersion);
end;
end;

function TWVLoader.GetAvailableBrowserVersionWithOptions : wvstring;
var
TempVersion : PWideChar;
Expand Down
2 changes: 1 addition & 1 deletion update_WebView4Delphi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 168,
"InternalVersion" : 17,
"Name" : "webview4delphi.lpk",
"Version" : "1.0.2903.40"
}
Expand Down

0 comments on commit 3b4a20f

Please sign in to comment.