Hi Ted, I am still not convinced that this works ;-) The class that is created by VisualStudio when you drop the Webbrowser ActiveX onto the toolbar is derived from AxHost. Therefore all internal implementations of AxHost are used if you use the Webbrowser control in .Net. If you look at AxHost with Anakrino you can see that AxHost itself implements OleClientSite in a private class called OleInterfaces. The approach you describe in your book sets a new OleClientSite, and therefore the implementation of IOleClientSite that AxHost provides is disabled (every ActiveX control can only have one client site).
Now: OleInterfaces not only implements IOleClientSite, but also IOleControlSite, IOleInPlaceSite etc. The solution described in your book doesn't provide implementations of these interfaces. Since there is real code in the implementation of these interfaces in OleInterfaces (e.g. IOleInPlaceSite::GetWindowContext, IOleControlSite.TransformCoords etc.) I guess they are vital for the link between a class that derives from AxHost... Your solution basically disconnects these functions from the ActiveX control, doesn't it? If I am completely mistaken, please correct me! David > -----Original Message----- > From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of > Ted Faison > Sent: Wednesday, May 01, 2002 12:50 AM > To: [EMAIL PROTECTED] > Subject: Re: [DOTNET] AxHost and IDocHostUIHandler: Check this new book > out > > David, > > Class AxHost is used to wrap the WebBrowser ActiveX component. The > wrapping > process is carried out automatically when you drop the WebBrowser > component > from the ToolBox onto a form in the Visual Studio Designer. It is unusual > to use class AxHost directly (and I haven't had reason to do so yet). > > The WebBrowser customizations described in the book are accomplished by a > Windows Form (which can easily be replaced by a UserControl) that acts as > an IOleClientSite and implements MsHtml customization interfaces, such as > IDocHostUIHandler. The book shows the C# implementation of the following > Ole interfaces: IOleClientSite, IOleObject, IDocHostUIHandler, > IDocHostShowUI and ICustomDoc. > > --Ted > > On Mon, 29 Apr 2002 22:26:02 +0100, David Anthoff > <[EMAIL PROTECTED]> > wrote: > > >Oh, one more question: Would your approach still allow me to use > >AxHost's default implementation of IOleClientSite, IOleControlSite, > >IOleInPlaceSite, IPropertyNotifySink and ISimpleFrameSite that are > >implemented in the private class OleInterfaces inside AxHost? If not, do > >you provide alternative implementations for all these interfaces that > >work the same way? I did think about just setting my own site via > >IOleObject::SetClientSite, but figured that I would then more or less > >break the internal handling of AxHost... > > > >Generally it looks as if Microsoft should have provided a way to use > >their implementation of all these interfaces via something like good old > >COM aggregation... Or are I am mistaken here? > > > >Thanks a lot for your help! > >David > > > >> -----Original Message----- > >> From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf > >Of > >> Ted Faison > >> Sent: Monday, April 29, 2002 9:17 PM > >> To: [EMAIL PROTECTED] > >> Subject: Re: [DOTNET] AxHost and IDocHostUIHandler: Check this new > >book > >> out > >> > >> David, > >> > >> The book shows how to make a Windows Form act as an OleClientSite, > >> allowing > >> all the various customization interfaces (such as IDocHostUIHandler, > >> IDocHostShowUI and others) to be handled. > >> > >> --Ted > >> > >> > >> On Sun, 28 Apr 2002 11:48:13 +0100, David Anthoff > >> <[EMAIL PROTECTED]> > >> wrote: > >> > >> >That sounds promising. I have one question though before I will buy > >the > >> >book: There are generally two ways to implement the > >IDocHostUIHandler. > >> >The first option is to attach it to the document via ICustomDoc, the > >> >second is to implement it at the client site for the ActiveX control. > >> >Which one is described in your book? I am only interested in the > >second > >> >method, since some of the features of IDocHostUIHandler will not work > >if > >> >you attach your implementation via ICustomDoc (e.g. the flags that > >> >remove the border of the control). > >> > > >> >Thanks for the answer! > >> >David > >> > > >> >> -----Original Message----- > >> >> From: dotnet discussion [mailto:[EMAIL PROTECTED]] On > >Behalf > >> >Of > >> >> Ted Faison > >> >> Sent: Saturday, April 27, 2002 11:22 PM > >> >> To: [EMAIL PROTECTED] > >> >> Subject: Re: [DOTNET] AxHost and IDocHostUIHandler: Check this new > >> >book > >> >> out > >> >> > >> >> There is a complete example of WebBrowser customization in the new > >> >> book "Component-based development with Visual C#", available at > >> >> > >> >> > >http://www.amazon.com/exec/obidos/ASIN/0764549146/qid=1019945959/sr=1- > >> >> 1/ref=sr_1_1/104-7524942-0873504 > >> >> > >> >> Chapter 8 shows how to add IDocHostUIHandler and other interfaces > >to a > >> >> host > >> >> form to fully customize the WebBrowser control. > >> >> > >> >> --Ted Faison > >> >> > >> >> You can read messages from the DOTNET archive, unsubscribe from > >> >DOTNET, or > >> >> subscribe to other DevelopMentor lists at > >http://discuss.develop.com. > >> > > >> >You can read messages from the DOTNET archive, unsubscribe from > >DOTNET, > >> or > >> >subscribe to other DevelopMentor lists at http://discuss.develop.com. > >> > >> You can read messages from the DOTNET archive, unsubscribe from > >DOTNET, or > >> subscribe to other DevelopMentor lists at http://discuss.develop.com. > > > >You can read messages from the DOTNET archive, unsubscribe from DOTNET, > or > >subscribe to other DevelopMentor lists at http://discuss.develop.com. > > David, > > Class AxHost is used to wrap the WebBrowser ActiveX component. The > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.