3

My first attempt to try the new TEdgeBrowser fails with 'The system can't find the file'

procedure TFrmTEdgeBrowser.BtnNavigateClick(Sender: TObject);
var lErrCode: Integer;
begin
  if not EdgeBrowser.Navigate('https://www.google.com') then
  begin
     lErrCode := EdgeBrowser.LastErrorCode;
     ShowMessage(IntToStr(lErrCode) + ': ' + SysErrorMessage(lErrCode));
  end;
end;

Error code -2147024894 = $80070002 is indeed ERROR_FILE_NOT_FOUND

Sequence (e.g as per https://www.delphipraxis.net/204266-new-vcl-tedgebrowser-component-coming-rad-studio-10-4-a.html or http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TEdgeBrowser_Component_and_Changes_to_the_TWebBrowser_Component):

  • New Win10 VM, start Edge, win installer runs and install Edge correctly
  • Download and install Edgeview2 SDK through GetIt
  • Copy c:\Program Files (x86)\Embarcadero\Studio\21.0\Redist\win32\WebView2Loader.dll to app dir

Config: Delphi 10.4.3 Sydney, running a 32 bit app in a Win10 VM, Edge 84.0.522.52 installed

Attempts: no https: in front, reboot, tried to get more info from a TApplicationEvents.OnException

I then tried to run the demo c:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\VCL\WebBrowser\Edge\EdgeBrowser.dproj (with the dll copied into that directory as well) but this gives the initialization error from the end of its:

procedure TfrmMain.EdgeBrowserCreateWebViewCompleted(Sender: TCustomEdgeBrowser; AResult: HResult);
begin
{$IFDEF DEBUG}
  OutputDebugString('EdgeBrowser OnCreateWebViewCompleted');
{$ENDIF}
  if Succeeded(AResult) then
  begin
    tbCancel.Enabled := True;
    tbReload.Enabled := True;
    tbGo.Enabled := True;
    edtAddress.Enabled := True;
    Sender.AddWebResourceRequestedFilter('*', COREWEBVIEW2_WEB_RESOURCE_CONTEXT_IMAGE);
  end
  else
  begin
    if AResult = HResultFromWin32(ERROR_FILE_NOT_FOUND) then
      Application.MessageBox('Could not find Edge installation. ' +
        'Do you have a version installed that''s compatible with this WebView2 SDK version?',
        'Edge initialisation error', MB_OK or MB_ICONERROR)
    else
      Application.MessageBox('Failed to initialise Edge browser control',
        'Edge initialisation error', MB_OK or MB_ICONERROR)
  end;
end;

But now AResult is -2147467259 = $80004005
which seems to be data/ODBC related.

Updating to a later version 0.9.579 (20 jul 2020) of Microsoft.Web.Webview2 did not help.

Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
  • Run [Process Explorer](https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer) and in the bottom pane make sure your DLL is actually loaded in your EXE and not one that is located elsewhere. Do the same when running Edge to see if it doesn't load different/more DLLs. – AmigoJack Aug 03 '20 at 14:28
  • Edge Chromium is now officially released. If Windows updates are applied, you should have it already (I have version 84.0.522.52). – Olivier Aug 04 '20 at 08:16
  • @Olivier Same version here – Jan Doggen Aug 06 '20 at 14:00
  • @AmigoJack No DLLs at all in my test app; no webview2loader.dll for MSEdge.exe – Jan Doggen Aug 11 '20 at 14:31
  • I'm having the exact same issue, did you ever figure out the solution? – Austin Shaw Aug 12 '20 at 16:05
  • @AustinShaw Not yet. I have tried the DLL update yesterday, but it has low priority related to other work. When I find out, I'll surely post an answer. – Jan Doggen Aug 12 '20 at 16:14

1 Answers1

0

I downloaded the Beta Version of Edge and that fixed it for me.

I was using version 84.0.522.59 (Official build) (64-bit), and had the same problem as you.

The version I downloaded was 85.0.564.30 (Official build) beta (64-bit).

Also, I looked back over the documentation and it says to get the canary channel version. So while I downloaded the beta version, I'm assuming the canary version is what you are supposed to download, and will also fix the problem.

http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TEdgeBrowser_Component_and_Changes_to_the_TWebBrowser_Component

The Microsoft Edge Chromium-based browser currently available from https://www.microsoftedgeinsider.com/download (Canary channel version whilst the WebView2 SDK is in pre-release, currently the minimum required version is 82.0.430.0).

Austin Shaw
  • 324
  • 1
  • 2
  • 12
  • That is weird. So now there is an 'official' release for Edge and that does not work ;-) Well, we're only in the exploring/testing stage right now (can we replace CEF4Delphi with something else?), I'll give this a try. If we get this to work and want to use this in production code, this will have to wait until our clients have an *official* version *that works*. – Jan Doggen Aug 13 '20 at 18:59
  • @JanDoggen I completely agree. I could've sworn that I read some documentation stating once Edge was officially released with the windows updates, we could just use that version, but now i can't find it. Oh well, I guess we wait. I'm not sure I'll even be able to use this new component, because it is missing a lot of features that we used from the old component (post data, document access, etc). Hopefully embarcadero enhances it significantly. – Austin Shaw Aug 13 '20 at 22:51
  • Confirmed. I just downloaded the Canary version (86.something) and that works fine. – Jan Doggen Aug 18 '20 at 15:30