Hi,
This is known issue in WebView2 :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/356
https://github.com/MicrosoftEdge/WebView2Feedback/issues/286
https://github.com/MicrosoftEdge/WebView2Feedback/issues/708
The suggested workaround is to use a browser in "
Windowless mode". See the
WindowlessBrowser demo for all the details.
The Windowless mode uses the DirectComposition API :
https://docs.microsoft.com/en-us/windows/win32/directcomp/directcomposition-portal
At this moment Delphi doesn't support the DirectComposition API so we have to use the MfPack component available at GitHub :
https://github.com/FactoryXCode/MfPack
Another possible workaround :
CEF has a similar issue and the suggested workaround is to use WS_EX_NOACTIVATE as the window style. I haven't tried this in WebView2 but perhaps you can call SetWindowLongPtr at some point. I'm not sure which handle you should use with SetWindowLongPtr but here you have some possibilities :
Code: Select all
SetWindowLongPtr(Form1.Handle, GWL_EXSTYLE, WS_EX_NOACTIVATE);
SetWindowLongPtr(WVBrowser1.RenderCompHWND, GWL_EXSTYLE, WS_EX_NOACTIVATE);
SetWindowLongPtr(WVBrowser1.D3DWindowCompHWND, GWL_EXSTYLE, WS_EX_NOACTIVATE);
SetWindowLongPtr(WVBrowser1.Widget0CompHWND, GWL_EXSTYLE, WS_EX_NOACTIVATE);
SetWindowLongPtr(WVBrowser1.Widget1CompHWND, GWL_EXSTYLE, WS_EX_NOACTIVATE);
Let us know if you managed to make WS_EX_NOACTIVATE work!
