Implementing Shell Desk Band and Internet Explorer Bars


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

Click here for a larger image.

Click here for a larger image.


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.


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

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.

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.

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

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.

Marks the end of the menu map.

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, ...).

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.


class CShellModule : public CComModule

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

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.


template < const CLSID *pclsid,const _ATL_MENUMAP_ENTRY *pMenu = NULL >
class ATL_NO_VTABLE CDeskBand : public CComObjectRootEx<CComSingleThreadModel>, IObjectWithSite, IPersistStream, IDeskBand, IContextMenu

CDeskBand implements Shell Desk Band and IE Bars objects. It provides five protected virtual methods you can override:

  • LRESULT OnCreate( LPCREATESTRUCT lpCreateStruct ) -- WM_CREATE message handler
  • LRESULT OnDestroy() -- WM_DESTROY message handler
  • LRESULT OnPaint() -- WM_PAINT message handler
  • LRESULT OnCommand( WPARAM wParam, LPARAM lParam ) -- WM_COMMAND message handler
  • LRESULT OnMsg( HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam ) -- generic message handler excluding previous messages

For your Band object, you should derive your own class from CDeskBand. Let's see the example:

extern const CLSID CLSID_SampleDeskBand;

class CSampleDeskBand : public CComCoClass<CSampleDeskBand,
   public CDeskBand<&CLSID_SampleDeskBand,DeskBandMenu>


  virtual LRESULT OnPaint();

  // your data data members


Download demo project
Download source


  • Opening Link in Main Browser

    Posted by maverick786us on 03/14/2011 05:29pm

    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

  • Refreshing the page

    Posted by maverick786us on 06/21/2010 09:06am

    How can I refresh the page at DISPID_DOCUMENTCOMPLETE event?

  • Error

    Posted by maverick786us on 06/15/2010 07:59am

    I downloaded the demo project and this is the error I am receiving
    IUnknown' not accessible because 'CDeskBand' uses 'private' to inherit from 'IObjectWithSite'

  • Auto/Manual Load/Unload?

    Posted by TBoneX on 07/04/2006 05:00pm

    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

  • Rgester the DLL

    Posted by Legacy on 08/05/2003 07:00am

    Originally posted by: Hariharan

    How can i regester the DLL,
    I tried using the regsvr32 method but the tool band dose not appear in the explorer, even in the view menu.

    Plz let me know how to regester and use the dll

  • Compilation fails with .NET 2003

    Posted by Legacy on 05/20/2003 07:00am

    Originally posted by: Justin Howard

    Sample's compilation is failing with:
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlcom.h(2804) : error C2248: 'IUnknown' : cannot access inaccessible struct declared in class 'ATL::CComContainedObject'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\Unknwn.h(110) : see declaration of 'IUnknown'

    Any ideas ayone? I can't figure out what's changed in ATL. It all looks fine to me.

  • How do you capture events? Mouse Clicks, etc?

    Posted by Legacy on 09/24/2002 07:00am

    Originally posted by: 187

    How would you capture events {i.e.e mouse movemeent, clicks, etc? AS well how would you place controls [buttons, edit boxes, etc.] on the bar?

  • Cool, but how can I unregister it?

    Posted by Legacy on 06/13/2002 07:00am

    Originally posted by: Alexi Jordanov

    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).

    Regards, Alex

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date