Creating Band Object Using ATL HTML Control ++


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

Environment: VC6 SP4, Windows 2000 SP2, IE55 Header files

There have been quite a few articles about Band Object already. However, when I was building my own band object, it sometimes took days just to search for the solution to a minor problem in creating a band object. Some of the articles provide the information about how to do this, but skips other steps; some show how to do this one thing, but it assumes that you know how to do all the steps prior to doing that. For this reason, I decided to put what I have done with band object together as a sample. I hope this article would be of help in saving some of you from being frustrated.

The Basics

Band objects are essentially COM objects that exist within a container. The container of a band object depends on the type to which the band object belongs. If the band object is a tool band, it will be contained by the Rebar Control that holds Internet Explorer's toolbars; if it is an Explorer Bar, it will be contained by Internet Explorer. Despite the difference between their functionalities, their basic implementations are similar. What really makes the difference is how the band object is registered, which in turn controls the type of the object and its container.

Since a band object is a COM object, it must implement IUnknown interface. In additional to IUnknown interface, all the band objects must implement IDeskBand, IObjectWithSite, and IPersistStream interfaces. A band object must also implement IInputObject interface, if it is to accept user input. To add items to the context menu, it must implement IContextMenu interface. Because band objects implement a child window, they must also implement a window procedure to handle Windows messaging. The window procedure can be implemented by using ATL message map (see sample code for more detail).


In addition to having their CLSIDs registered, the Explorer Bar and desk band objects must be registered for the appropriate component category. As previously mentioned, registering the component category determines the object type and its container. Tool bands do not have a CATID. The CATIDs for the three band objects that require them are:

Please reference to sample code for more detail (CGBand.cpp).

Frequently Asked Questions

When I am poking around CodeGuru and some other websites dedicated for developers, I often see people asking questions about band objects. Some of those questions that are frequently asked are:

  • Installed Explorer Bar not displayed in taskbar shortcut menu
  • How to automate Internet Explorer from a band object?
  • How to extract the HTML documents?
  • How to handle events fired by Internet Explorer?
  • How to solve 'window.external' problem?

The cause to the first problem is due to the Windows 2000 shell caches the available desktop band objects and only updates this cache if it senses that an installation application is run or if the cache location in the registry is not present. To solution proposed by Microsoft is to install your band object from an application that has the name Setup.exe or Install.exe. If the proposed solution is not feasible, you need to delete the following keys in Windows Registry before or after you install your band object:

HKEY_CLASSES_ROOT\\Component Categories\\{00021492-0000-



I have included the solutions to other problems in the sample code. The solution to the 'window.external' problem is based on the resolution proposed in Q202009, in which Microsoft confirmed the problem to be a bug.

A Sample Implementation

In additional to demonstrating how to implement an Explorer Bar, this sample implementation also shows:

  • How to automate a Internet Explorer from a band object
  • How to extract HTML documents
  • How to handle the events fired by Internet Explorer from a band object
  • How to fix a bug that causes an error when accessing 'window.external' in an ATL DHTML control

For changing the title of the band object (Explorer Bar), look for CCGBandObj::GetBandInfo. For changing the title shown in taskbar shortcut menu, look for CGBandObj.rgs. For registration, look in CGBand::DllRegisterServer. For event handling, look in CCGBandObj::SetSite.



Download demo project - 54.6 Kb
Download source - 50.1 Kb


  • Opening Link in Main Browser

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

    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 04:57pm

    Great article. I created a deskband myself (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 do programatically make explorer loading/unloading my deskbar and/or autoload it on startup? Any help would be greatly appreciated TBone

  • Release crush

    Posted by ethan on 07/18/2004 05:14am

    when compile release config, opening band in ie throw exception. why?

  • How do I intercept keystroks

    Posted by yirgalem on 06/02/2004 06:43pm

    I know the first answer already... which is to implement IOleControlSite and IInputObject and override some functions as demonstrated in http://www.microsoft.com/mind/0499/faq/faq0499.asp. I did all that and I still don't have any luck. I think it may be because the control is passed to CUICGBandObj in your sample and the CCGBandObj instance would not receive the events. In any case, I really need help so I can allow user to hit tab to get from one input control to another on the HTML page on the explorer bar, as well as be able to delete characters in text boxes in the HTML page. Please help... -Dan

  • How can I add ActiveX control on IE BAND

    Posted by Legacy on 01/06/2004 08:00am

    Originally posted by: Balkrishna Talele

    After completing my creation of band, I want to Add IWebBrowser View on that band , so that I should be able to scroll the Html tags or I can Marquee the html tags on that Activex Control. But this should be on the IE BAND...how to do that.
    Balkrishna Talele

  • Win32 Unicode ?

    Posted by Legacy on 09/09/2003 07:00am

    Originally posted by: Shashank Sharma

    For deployment on Win XP, should "Win32 Unicode" configuration be used ?

  • Language Support for ATL

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

    Originally posted by: Ahmed Birry

    does the Supports Arabic language ??? if any body here can help please !!!

  • Pls Help me :Plugging Active X Controls in IE toolbar

    Posted by Legacy on 01/11/2003 08:00am

    Originally posted by: Arivu

    Dear all,

    I'm a beginer in VC++ development side.Could anybody help me to plug an Active X Control in IE tool bar?.It is a very urgent task..
    If you help me,it will save my job.


  • Developing Search ToolBar for IE

    Posted by Legacy on 10/23/2002 07:00am

    Originally posted by: Vipin Singh

    I want to develop a toolbar for IE 5.0 and above. Can you please tell me how can I do it or is any one having a sample code that can attach a toolbar to IE window. Pls. reply as soon as possible as this is urgent. Any help will be greatly appreciated.


  • How create tool band?

    Posted by Legacy on 10/15/2002 07:00am

    Originally posted by: Nickolay

    How create tool band for IE?

  • Loading, Please Wait ...

  • 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