开发者

handle of DISPID_ONVISIBLE

开发者 https://www.devze.com 2023-03-28 21:41 出处:网络
I try to hide IWebBrowser2 which I put to DISPID_NEWWINDOW2. 开发者_StackOverflow社区But have no lucky :-(

I try to hide IWebBrowser2 which I put to DISPID_NEWWINDOW2.

开发者_StackOverflow社区

But have no lucky :-(

IWebBrowser2 always visible after Navigate. That is why I try to handle DISIP_ONVISIBLE and call put_Visible(VARIANT_FALSE) to hide IWebBrowser2 but this event I receive only when call put_Visible() by myself...

How to solve my task?

Thanks for any help.


Implement NewWindow2 or NewWindow3 and set ppDisp to a new instance of IWebBrowser2.
To make sure that this new instance is not visible use put_Visible or call ShowWindow(SW_HIDE) on the control's container.
You could also set *Cancel = VARIANT_TRUE to disable the popup altogether.
Implementing NewWindow3 will give you the destination url.

STDMETHODIMP CMyBrowser::OnNewWindow3(IDispatch **ppDisp, 
                                      VARIANT_BOOL *Cancel, 
                                      DWORD dwFlags, 
                                      BSTR bstrUrlContext, 
                                      BSTR bstrUrl)
{
  // spWebBrowser = create a newly instance of IWebBrowser2
  ppDisp = (IDispatch*)spWebBrowser;
  return S_OK;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消