I use the suggested approach in my application (i.e., I create a hidden popup window and then destroy it later) and it works well. I did have to apply the following patch to browser_impl_win.cc, however, because the call to UIT_CreateBrowser calls SetWindowPos with SWP_SHOWWINDOW:
- Code: Select all
Index: browser_impl_win.cc
===================================================================
--- browser_impl_win.cc (revision 199)
+++ browser_impl_win.cc (working copy)
@@ -141,9 +141,18 @@
// Size the web view window to the browser window
RECT cr;
GetClientRect(window_info_.m_hWnd, &cr);
- SetWindowPos(UIT_GetWebViewWndHandle(), NULL, cr.left, cr.top, cr.right,
- cr.bottom, SWP_NOZORDER | SWP_SHOWWINDOW);
+ // Respect the WS_VISIBLE window style when setting the window's
+ // position
+ UINT flags = SWP_NOZORDER;
+ if (window_info_.m_dwStyle & WS_VISIBLE) {
+ flags |= SWP_SHOWWINDOW;
+ } else {
+ flags |= SWP_HIDEWINDOW;
+ }
+ SetWindowPos(GetWebViewWndHandle(), NULL, cr.left, cr.top, cr.right,
+ cr.bottom, flags);
+
if(handler_.get()) {
// Notify the handler that we're done creating the new window
handler_->HandleAfterCreated(this);
Marshall, if you think it's a useful patch in general, I can create an issue for it in the tracker; I wanted to run it by you first, since I may be missing something subtle here.
Emerick