13.1 How Band Objects Work

only for RuBoard - do not distribute or recompile

13.1 How Band Objects Work

Talking about band objects can get a little confusing, so let's get some terminology straight before we continue. Band object refers to the component that is implementing the band.

Each registered band object has a corresponding menu item under the View figs/u2192.gif Explorer Bar menu on Explorer's frame window. Band objects are registered under the CLSID key in the registry like so:

 HKEY_CLASSES_ROOT\     CLSID\         {CLSID}\    Default = Menu Name             Implemented Categories\                 {CATID} 

{ CLSID } , in this instance, is the CLSID of the band object. { CATID } , on the other hand, is a component category identifier that designates the band as either a Desk Band, an Explorer band, or a Communication band.

When the menu item specified by the default value of { CLSID } is selected, Explorer loads the band object and initializes it through IObjectWithSite by passing a site pointer to the band object (see Chapter 12). The site pointer allows the band object to communicate with the site in the container (the container being the actual band Explorer will create for the band object window).

The band object's first priority, after it has grabbed its own copy of the site pointer, is to obtain the window handle for the container in which it will live. Explorer creates the container for the band object automatically (thus saving us much toil), so all the band object needs to do is query the site pointer for IOleWindow . This interface contains a method, GetWindow , that will provide the band object with a handle to the container window. Armed with the window handle, the band object merely needs to create an instance of its window (this is a normal VB form without a border). Once this has been accomplished, it can use the Windows API to make it a child window of the window returned by GetWindow .

Explorer will begin calling methods on the band object's primary interface, IDeskBand . It will determine the dimensions of the band by calling IDeskBand::GetBandInfo , which it will use in order to construct a band that is the proper size ("proper size" most likely meaning the size of the VB form).

It will also call IDeskBand::GetWindow , which is kind of interesting, because this is the same method the band object calls to get Explorer's container window handle. ( IDeskBand is derived from IOleWindow .) Explorer is now turning around and asking the band object for its window. The band object then passes the handle to its window (i.e., to the VB form).

When Explorer is ready to show or hide the window, it will call IDeskBand::ShowDW , and when it is ready to destroy the window, it will call IDeskBand::CloseDW . In case you're wondering, the "DW" at the end of these two methods stands for "docking window."

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