14.1 How Docking Windows Work

only for RuBoard - do not distribute or recompile

14.1 How Docking Windows Work

It takes a least two objects to create a functional docking window. The first is the primary objectthe object that wants to display a docking window (a namespace extension, BHO, band , etc.). The second object is the docking window itself. It contains all of the implementation code specific to docking windows. In this way, the relationship between the primary object and the docking window is similar to the one between a shell folder and a view; it allows the possibility of a one-to-many relationship.

The docking window object is very much like a band object in that it implements IObjectWithSite and IDockingWindow . IDeskband , which is the primary interface for band objects, is derived from IDockingWindow . So essentially , a docking window must implement the same core functionality as a band object; it must be able to respond to the shell's requests to show, close, and resize the window. Additionally, it must also be able to provide a window handle (of the docking window) to Explorer. This behavior is no different from that of band objects. Well, actually, there is one difference, which we've already talked about: band objects do not have to provide resize information to the shell. Docking windows do.

In order for the primary object to create a docking window, it must first get its hands on an IServiceProvider interface. Depending on the circumstances, this is done in one of two ways. If the component implements IObjectWithSite , as is the case with BHOs, browser extensions, or band objects, all it has to do is query the site pointer passed in by the shell. (See the discussion of site pointers in Chapter 12.) If the component is a namespace extension, it can get to IServiceProvider by means of the IShellBrowser interface that is passed to the component in the IShellView::CreateViewWindow method.

Once the primary object has an IServiceProvider interface pointer, it can then call the QueryService method to get IDockingWindowFrame ; this contains a method called AddToolbar . AddToolbar is the method that is used to add a docking window to Explorer. When the component calls AddToolBar , it passes a reference to an object that implements IDockingWindow (and IObjectWithSite ). This object, of course, is the docking window. From this point, control is transferred from the primary component to the docking window.

Once the shell has access to the docking window object, it calls IObjectWithSite::SetSite . The docking window object uses the site pointer in order to obtain a reference to IDockingWindowSite . This interface will help the docking window negotiate its border space within the client area of Explorer.

After the docking window determines its position, it is displayed.

only for RuBoard - do not distribute or recompile


Visual Basic Shell Programming
Visual Basic Shell Programming
ISBN: B00007FY99
EAN: N/A
Year: 2000
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net