Search Results

Search found 1 results on 1 pages for 'wangminhere'.

Page 1/1 | 1 

  • How can I create a WebBrowser control (ActiveX / IWebBrowser2) without a UI?

    - by wangminhere
    I cannot figure out how to use the WebBrowser control without having it create a window in the taskbar. I am using the IWebBrowser2 ActiveX control directly because I need to use some of the advanced features like blocking downloading JAVA/ActiveX/images etc. That apparently is not available in the WPF or winforms WebBrowser wrappers (but these wrappers do have the ability to create the control with no UI) Here is my code for creating the control: Type webbrowsertype = Type.GetTypeFromCLSID(Iid_Clsids.CLSID_WebBrowser, true); m_WBWebBrowser2 = (IWebBrowser2)System.Activator.CreateInstance(webbrowsertype); m_WBWebBrowser2.Visible = false; m_WBOleObject = (IOleObject)m_WBWebBrowser2; int iret = m_WBOleObject.SetClientSite(this); iret = m_WBOleObject.SetHostNames("me", string.Empty); tagRECT rect = new tagRECT(0, 0, 0, 0); tagMSG nullMsg = new tagMSG(); m_WBOleInPlaceObject = (IOleInPlaceObject)m_WBWebBrowser2; //INPLACEACTIVATE the WB iret = m_WBOleObject.DoVerb((int)OLEDOVERB.OLEIVERB_INPLACEACTIVATE, ref nullMsg, this, 0, IntPtr.Zero, ref rect); IConnectionPointContainer cpCont = (IConnectionPointContainer)m_WBWebBrowser2; Guid guid = typeof(DWebBrowserEvents2).GUID; IConnectionPoint m_WBConnectionPoint = null; cpCont.FindConnectionPoint(ref guid, out m_WBConnectionPoint); m_WBConnectionPoint.Advise(this, out m_dwCookie); This code works perfectly but it shows a window in the taskbar. If i omit the DoVerb(OLEDOVERB.OLEIVERB_INPLACEACTIVATE) call, then Navigating to a webpage is not working properly. Navigate() will not download everything on the page and it never fires the DocumentComplete event. If I add a DoVerb(OLEIVERB_HIDE) then I get the same behavior as if I omitted the DoVerb(OLEDOVERB.OLEIVERB_INPLACEACTIVATE) call. This seems like a pretty basic question but I couldn't find any examples anywhere.

    Read the article

1