Using the WebBrowser Control
- From: Norman Bullen <norm@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 02 Sep 2007 17:27:06 -0700
I am trying to embed a WebBrowser control in my application to display
some HTML pages. Following the example on MSDN at
http://msdn2.microsoft.com/en-us/library/aa770041.aspx#WebBrowser_Customization_Architecture , I have called OleInitialize() and CoCreateInstance() to create an instance of the WebBrowser control and get an IOleObject pointer. I then called IOleObject::SetClientSite() passing a pointer to an object of class MySite that I created based on IOleClientSite.
MSDN says that the WebBrowser control will call QueryInterface() in this
IOleClientSite object to get interfaces to IDocHostUIHandler,
IDocHostUIHandler2 and IDocHostShowUI. My QueryInterface method is
called with requests for IID_IServiceProvider, IID_IOleInPlaceSite, and
IID_IDispatch but never for the interfaces that I was told to expect. My object's AddRef() method is also called once.
I then call IOleObject::QueryInterface() to get a pointer to the IWebBrowser2 interface and IOleObject::Release() to release the IOleObject.
Since I have not yet written the code that will actually use the WebBrowser control, I immediately call IWebBrowser2::Quit() and IWebBrowser2::Release(). When I do that, debugging code that I inserted into MySite complains that the reference count has not been decremented to zero.
Questions:
Why isn't the WebBrowser control looking for the interfaces that MSDN
says it should want and why is it looking for interfaces that were not
mentioned by MSDN?
Why does it increment the reference count in MySite but never decrements it?
I must be missing something but, given the nature of the documentation for the WebBrowser control, I haven't found it yet.
Thanks for any assistance,
Norm
.
- Follow-Ups:
- Re: Using the WebBrowser Control
- From: Igor Tandetnik
- Re: Using the WebBrowser Control
- From: Sheng Jiang[MVP]
- Re: Using the WebBrowser Control
- Next by Date: BHO AND TOOL BAR BUTTON
- Next by thread: Re: Using the WebBrowser Control
- Index(es):