Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2006

Tip: Looking for answers? Try searching our database.

Override of WebBrowserSite IDocHostUIHandler using WebBrowser.CreateWebBrowserSiteBase doesn't work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Don Walker - 24 Feb 2006 20:44 GMT
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.
elucent@gmail.com - 26 Feb 2006 23:18 GMT
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?
Charles Law - 28 Feb 2006 13:15 GMT
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

> According to
> http://msdn2.microsoft.com/en-us/library/system.windows.forms.
[quoted text clipped - 35 lines]
>
> Thanks.
elucent@gmail.com - 01 Mar 2006 19:49 GMT
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

> Hi Don
>
[quoted text clipped - 7 lines]
>
> Charles

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.