According to http://msdn2.microsoft.com/en-us/library/system.windows.forms.
webbrowser.createwebbrowsersitebase.aspx I should be able to customize the
behavior of the System.Windows.Forms.WebBrowser control as follows:

"To use this feature, implement classes that inherit from the WebBrowser and
WebBrowser.WebBrowserSite classes. The unmanaged WebBrowser ActiveX control
uses the protected CreateWebBrowserSiteBase method to retrieve extensibility
interfaces implemented by the WebBrowser.WebBrowserSite class. Override the
CreateWebBrowserSiteBase method to return an instance of your own class that
inherits from the WebBrowser.WebBrowserSite class. The WebBrowser.
WebBrowserSite class provides default implementations of the OLE
IDocHostUIHandler. You can provide your own implementation of this interface
or implement any other WebBrowser ActiveX control interface in order to
customize the behavior of the control. If you provide your own
implementation for any IDocHostUIHandler members, you must implement all the
members of that interface."

I've implemented my own classes and confirmed in debug that my version of
CreateWebBrowserSiteBase is being called and creates my class. However, none
of my IDocHostUIHandler methods are being called. I suspect that the problem
may be in my constructor, which calls the WebBrowser.WebBrowserSite
constructor, which creates a competing implementation of IDocHostUIHandler.

The documentation implies that this should work. Am I missing anything? Any
suggestions or workarounds?

Thanks.

Re: Override of WebBrowserSite IDocHostUIHandler using WebBrowser.CreateWebBrowserSiteBase doesn't work by elucent

elucent
Sun Feb 26 17:18:31 CST 2006

I ran into the same problem. The IDocHostUIHandler implementation is
NOT being called in my extended WebBrowserSite class. If using the
reflection, you can find out the extended class has 2 IDocHostUIHandler
interfaces. One is apparently from WebBrowserSite base class in the
System.Windows.Forms.UnSafeNativeMethods namespace, and the other is my
new implementation.

Any suggestion or progress on overriding the IDocHostUIHandler in the
base class?


Re: Override of WebBrowserSite IDocHostUIHandler using WebBrowser.CreateWebBrowserSiteBase doesn't work by Charles

Charles
Tue Feb 28 07:15:38 CST 2006

Hi Don

I have just answered a related question in the
microsoft.public.dotnet.languages.vb newsgroup.

Have a look at the thread "webbrowser control border" starting 22 Feb 2006
and see if this answers your question.

HTH

Charles


"Don Walker" <noemail@nospam.com> wrote in message
news:43720a11a2b94e20b8362182dc4bcfc9@ureader.com...
> According to
> http://msdn2.microsoft.com/en-us/library/system.windows.forms.
> webbrowser.createwebbrowsersitebase.aspx I should be able to customize the
> behavior of the System.Windows.Forms.WebBrowser control as follows:
>
> "To use this feature, implement classes that inherit from the WebBrowser
> and
> WebBrowser.WebBrowserSite classes. The unmanaged WebBrowser ActiveX
> control
> uses the protected CreateWebBrowserSiteBase method to retrieve
> extensibility
> interfaces implemented by the WebBrowser.WebBrowserSite class. Override
> the
> CreateWebBrowserSiteBase method to return an instance of your own class
> that
> inherits from the WebBrowser.WebBrowserSite class. The WebBrowser.
> WebBrowserSite class provides default implementations of the OLE
> IDocHostUIHandler. You can provide your own implementation of this
> interface
> or implement any other WebBrowser ActiveX control interface in order to
> customize the behavior of the control. If you provide your own
> implementation for any IDocHostUIHandler members, you must implement all
> the
> members of that interface."
>
> I've implemented my own classes and confirmed in debug that my version of
> CreateWebBrowserSiteBase is being called and creates my class. However,
> none
> of my IDocHostUIHandler methods are being called. I suspect that the
> problem
> may be in my constructor, which calls the WebBrowser.WebBrowserSite
> constructor, which creates a competing implementation of
> IDocHostUIHandler.
>
> The documentation implies that this should work. Am I missing anything?
> Any
> suggestions or workarounds?
>
> Thanks.



Re: Override of WebBrowserSite IDocHostUIHandler using WebBrowser.CreateWebBrowserSiteBase doesn't work by elucent

elucent
Wed Mar 01 13:49:51 CST 2006

Charles,

Thanks for sharing your answer here. I understand that I can implement
IDocHostUIHandler in the form or usercontrol where hosts the WebBrowser
net control. However, I need to extend the WebBrowser class to keep it
reusable without much of overheads. And MSDN clearly states that
WebBrowser is extensible thru WebBrowserSite class where i can
implement IDocHostUIHandler as well as other interfaces. While
implementing other interfaces turns out successfully, IDocHostUIHandler
yet has conflicts with the base class. Hopefully someone else will have
the answer soon.

Will

Charles Law wrote:
> Hi Don
>
> I have just answered a related question in the
> microsoft.public.dotnet.languages.vb newsgroup.
>
> Have a look at the thread "webbrowser control border" starting 22 Feb 2006
> and see if this answers your question.
>
> HTH
>
> Charles