Skip to content

WebView2 control is not visible after changing the parent window #985

Open
@DominikPalo

Description

@DominikPalo

Description
We are migrating our PowerPoint integration from CefSharp (a different Chromium-based webview control) to WebView2 and we have bumped into an issue when trying to change the parent window of a window with WebView2 control inside.

The way how our integration works is that we create a new WinForms window containing a WebView2 control and then during a slideshow, we occasionally cover the slideshow window with our WebView2 window (to "replace" the content of the presented slide). But, before we display that window, we need to change the parent window of our WebView2 window to the PowerPoint slideshow window (by calling the function SetParent with HWND of the PowerPoint Slideshow window) - so apps like Zoom or MS Teams stream also our WebView2 content while streaming just the PowerPoint slideshow window.

Unfortunately, it looks that the WebView2 WinForms control (unlike the CefSharp WinForms control) is not compatible with that solution: after changing the parent window, we can see just the empty WinForms window - the WebView2 control is not visible (although the embedded web is loaded).

Version
SDK: 1.0.790-prerelease
Runtime: 88.0.705.74 (Evergreen Bootstrapper)
Framework: WinForms
OS: Win10

Repro Steps

  1. Create a WinForms window with a WebVew2 control inside
  2. Change the parent window of that window using the SetParent function from Winuser.h to another (already visible) window
  3. Show the WinForms/WebView2 window
  4. Observe, that the parent window is covered by the empty WinForms/WebView2 window (the WebView2 control is not visible)

Additional context
The entire integration is built as a COM add-in (so it is running from the PowerPoint process).

AB#26124929

Metadata

Metadata

Labels

feature requestfeature requesttrackedWe are tracking this work internally.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions