jesu 3 Posted Friday at 11:16 AM Hello. I have an application in which I show some webpages and pdfs, so I'm using tedgebrowser. I have copied WebView2Loader.dll. In the same computer, some days it works, other days it doesn't work. I have a declaration: WebBrowser: TEdgeBrowser; First of all I do is to initialize it: WebBrowser.CreateWebView; and I have a procedure to know when it fails: procedure TFPrincipal.WebBrowserCreateWebViewCompleted(Sender: TCustomEdgeBrowser; AResult: HRESULT); begin // el problema de esto es que se llama de forma asíncrona y tarda un buen rato if Succeeded(AResult) then begin // ProcDebug('finalizó creación edge'); if WebBrowser.ControllerInterface <> nil then WebBrowser.ControllerInterface.Set_IsVisible(Integer(LongBool(True))); end else begin ShowMessage('>> Fallo en creación navegador hresult: ' + IntToStr(Aresult)); end; end; when it fails it returns hresult: -2147023496. I've tried to find the meaning and I arrived here: https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2weberrorstatus?view=webview2-winrt-1.0.2903.40 but I can't identify the issue. How can I know where's the problem? Thanks. Share this post Link to post
FPiette 392 Posted Friday at 11:55 AM 36 minutes ago, jesu said: -2147023496 You must convert this code to hexadecimal => 80070578 Then search Google for this code and edge browser. The code 80070578 means: "invalid window handle". Share this post Link to post
jesu 3 Posted Friday at 12:15 PM 24 minutes ago, FPiette said: Then search Google for this code and edge browser. The code 80070578 means: "invalid window handle". Thanks. The search only returns this page: https://github.com/MicrosoftEdge/WebView2Feedback/issues/3097 where they talk about random issues that are solved restarting the computer. Is there any other way I could/should try to restart the webview? Share this post Link to post
FPiette 392 Posted Friday at 04:09 PM 3 hours ago, jesu said: Is there any other way I could/should try to restart the webview? I don't know. I have written only one application which make use TEdgeBrowser. It's part of an automation process which runs every single day without any glitch. In that application, TEdgeBrowser is simply dropped on the VCL form. I don't even use OnCreateWebViewCompleted event. Share this post Link to post
salvadordf 37 Posted Saturday at 07:10 AM (edited) Try using WebView4Delphi and implement the TWVBrowser.OnInitializationError and GlobalWebView2Loader.OnInitializationError events. Check the GlobalWebView2Loader.ErrorMessage and GlobalWebView2Loader.ErrorCode values too. Keep the browser visible until it's fully initialized and then hide it. Edited Saturday at 07:17 AM by salvadordf Share this post Link to post
jesu 3 Posted 4 hours ago The problem of using a custom component is that if a vulnerability is discovered in Edge, we can blame Microsoft and expect that they solve it. If it happens in Chromium, who would solve it? Share this post Link to post
salvadordf 37 Posted 3 hours ago WebView4Delphi uses the WebView2 framework to embed an Edge browser. Edge is based on Chromium but the WebView2 framework is updated automatically by Windows. I just updated the readme in the repository to avoid confusions. I suggested WebView4Delphi because it gives you a lot more details in case of initialization problems. It's updated to the latest WebView2 framework version and it implements all the interfaces exposed by WebView2. Share this post Link to post