delphi - TEdgeBrowser 导航失败,出现错误 "File not found"

我第一次尝试新的 TEdgeBrowser 失败并显示“系统找不到文件”

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;

错误代码 -2147024894 = $80070002 is indeed ERROR_FILE_NOT_FOUND

顺序(例如根据 https://www.delphipraxis.net/204266-new-vcl-tedgebrowser-component-coming-rad-studio-10-4-a.html 或 http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TEdgeBrowser_Component_and_Changes_to_the_TWebBrowser_Component ):

  • 新的 Win10 VM,启动 Edge,win 安装程序运行并正确安装 Edge
  • 通过GetIt下载并安装Edgeview2 SDK
  • 复制 c:\Program Files (x86)\Embarcadero\Studio\21.0\Redist\win32\WebView2Loader.dll 到应用目录

配置:Delphi 10.4.3 Sydney,在 Win10 VM 中运行 32 位应用程序,安装了 Edge 84.0.522.52

尝试:前面没有 https:,重新启动,尝试从 TApplicationEvents.OnException 获取更多信息

然后我尝试运行演示 c:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\VCL\WebBrowser\Edge\EdgeBrowser.dproj(使用 dll也复制到该目录中)但这会从其末尾给出初始化错误:

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;

但现在 AResult 是 -2147467259 = $80004005
这似乎与数据/ODBC 相关。

更新到更高版本的 Microsoft.Web.Webview2 0.9.579(2020 年 7 月 20 日)没有帮助。

最佳答案

我下载了 Edge 的测试版并为我修复了它。

我使用的是 84.0.522.59 版本(官方构建)(64 位),并且遇到了与您相同的问题。

我下载的版本是85.0.564.30(正式版)beta(64位)。

此外,我回顾了文档,它说要获取金丝雀 channel 版本。因此,虽然我下载了测试版,但我假设金丝雀版本是您应该下载的,并且也会解决问题。

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).

关于delphi - TEdgeBrowser 导航失败,出现错误 "File not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63230261/

相关文章:

python - 如何使用 Elasticsearch-dsl 在 Django 中进行并行测试?

python-3.x - 无论如何,您是否可以检查 Azure CLI 在后台执行哪些 API 调用

laravel - 如何在 Laravel 中显示带有法语符号的验证消息?

angular - 在 Angular 10 中将 HTML 转换为 PDF

google-api - Google Calendar API 在单个批处理请求中返回 403 R

reactjs - 如何在 React 中添加对状态码 400 的验证

php - 使用 Laravel 的 Eloquent 将数据发送到数据库的问题

python - Django 信号卡在循环中

amazon-web-services - ECS 服务的两个或多个实例之间的通信

firebase - 如何将复杂的 Firestore 查询卸载到 Firebase Cloud F