Implementing Shell Desk Band and Internet Explorer Bars

Introduction

The Internet Explorer Bars are child windows within the main Explorer window, and Desk Band is a dockable window on the desktop/taskbar. Both can be used to display information or interact with the user. This article deals with the implementation of these Band objects.

Design

Creating an IE Bar or Desk Band requires you to implement several interfaces and a special registration procedure. To make life easier for you, I developed an ATL class, CDeskBand, which encapsulates all these boring things needed by COM and Windows Shell runtime. In addition, there is also a CShellModule class that serves to register/unregister COM objects.

New macros

BEGIN_TYPE_MAP(x)
Marks the beginning of the type map of Band ATL objects. The parameter x is an array holding _ATL_TYPEMAP_ENTRY structures that describe the objects' type.

END_TYPE_MAP()
Marks the end of the type map of Band ATL objects. When CShellModule::RegisterServer is called, it updates the system Registry for each object in the type map.

TYPE_ENTRY(clsid, type)
Enters the type of the Band object into the type map. Parameter clsid is a CLSID of the object to be entered into the map and type can be one of the following values:

DeskBand

VerticalExplorerBar

HorizontalExplorerBar

Using these macros is similar to the standard ATL BEGIN_OBJECT_MAP/OBJECT_ENTRY/END_OBJECT_MAP macros.

DECLARE_MENU_MAP(x)
Forward declaration of the menu map. Parameter x is the name of the map specific to one or more Band objects.

BEGIN_MENU_MAP(x)
Marks the beginning of the menu map. Parameter x is an array holding the _ATL_MENUMAP_ENTRY structures that describe menu items and must be the same as used in the previous macro.

END_MENU_MAP()
Marks the end of the menu map.

MENU_ENTRY(id,flags,item,help,verb)
Enters an item into the menu map. Parameter id should be unique within the map; for flags' parameter values you should look into the MSDN documentation for the InsertMenu function. Item parameter is a label displayed for a menu item; help parameter is a help string for an item; and verb a is language-independent command name (like open, save, ...).

MENU_ENTRY_SEPARATOR()
Enters a separator menu item into the menu map.

You should create the menu map only if you need special commands for your Band object (a typical usage may be the "Settings..." command). You can use one menu map for more Band objects.

CShellModule

class CShellModule : public CComModule

CShellModule implements a COM server module with extensions in the registration/unregistration procedure needed by Windows Shell.

HRESULT Init( _ATL_TYPEMAP_ENTRY *pdt, _ATL_OBJMAP_ENTRY *p, HINSTANCE h )
Initializes all data members. Parameter pdt is a pointer to the type map array; the other ones are the same as in the CComModule::Init method.

HRESULT RegisterServer( const CLSID *pCLSID = NULL )
Depending on the pCLSID parameter, updates the system Registry for a single class object or for all objects in the object map.

HRESULT UnregisterServer( const CLSID *pCLSID = NULL )
Depending on the pCLSID parameter, unregisters either a single class object or all objects in the object map.

Downloads

Comments

Opening Link in Main Browser

Posted by maverick786us
on 03/14/2011 10:29am

I made a slight modification with your code. Instead of buttons, its using hyperlinks. But when I open those hyperlinks, it opens in its own window. How can I make it open those links in the main window?
Thanks in Advance

Auto/Manual Load/Unload?

Posted by TBoneX
on 07/04/2006 10:00am

Great article.
I created a deskband myself (toolbar in the taskbar) which works fine. However, after installing it (e.g. via regsvr32.exe /c deskband.dll ) and rebooting, explorer wont load it automatically. The user has to right-click onto the taskbar and choose "Toolbars" and then select the toolbar in order to activate it.
How can I programatically make explorer loading/unloading my deskbar and/or autoload it on startup?
Any help would be greatly appreciated
TBoneX

Cool, but how can I unregister it?

Sorry, but I don't have much experience with COM technology. Can you explain me how can I unregister this control? I try to call _Module.Term(); and DllUnregisterServer(void); (in beggining of DllMain) but nothing happen.

Also I think that it's a good idea to tell us how we can append our node in "Folders" vertical bar and have some control on it (popup on rigth click, drag&drop).

Top White Papers and Webcasts

Live Event Date: March 19, 2015 @ 1:00 p.m. ET / 10:00 a.m. PT
The 2015 Enterprise Mobile Application Survey asked 250 mobility professionals what their biggest mobile challenges are, how many employees they are equipping with mobile apps, and their methods for driving value with mobility.
Join Dan Woods, Editor and CTO of CITO Research, and Alan Murray, SVP of Products at Apperian, as they break down the results of this survey and discuss how enterprises are using mobile application management and private …

The mobile market is white hot. Building a well-crafted product development plan that addresses market research, strategy, design, and development will provide the greatest chance for success. Each phase of an app's lifecycle is critical to the its overall success and feeds into the next step of the process of product development for the app. This white paper examines the five key phases of mobile app creation, one by one, to understand how they work together to help create a successful mobile app.