salvadordf/WebView4Delphi

Parenting / Handle Issues

mrAndrewLove opened this issue · 2 comments

I'm working on a Delphi legacy project that's in Delphi 2005. We want to move to web which would work much better than the client server application we're currently only. Long story short, we're wanting to create a form with an embedded browser that we can use as were replace different parts of the application. So I am not sure if this issue is specific to Delphi 2005 or not.

If I put a TWVBrowser on a form and hook it up to a TWVWindowParent on a Form. I do all the initialization etc. Anyhow I'm able to pull up web pages no problem.

The problem comes with ShowModal. Ideally I start the navigation then call show modal so there is a little less evident delay loading the page. If I use Form.Show this all works great, however when I use ShowModal which I often will need to do, The handles are all released and new handles are issued. The actual browsers parent becomes invalid. I've looked for a way to reassign the parent but haven't had much luck. Is there a way to reassign the parent in the event that the handle for the TWVWindowParent is release and renewed? Let me know if you want a demo project.

I haven't tried that but it seems to be supported by WebView2.

I guess that you can call SetParent with TWVBrowserBase.Widget0CompHWND as the first parameter.

In any case, Chromium creates some controls to show the web contents that are on top of everything else. I don't know if ShowModal can interfere with that but it's probably not necessary.

The first navigation is always a little slower because the browser has to initialize and sometimes it has to download the whole web page.

Please, use our forums for more questions :
https://www.briskbard.com/forum/

This issue is similar to #13.
#13