Click here to Skip to main content
11,806,931 members (63,385 online)
Click here to Skip to main content

An ATL Toolbox control like that of VS.NET 2003

, 4 Oct 2005 CPOL 37.6K 1.3K 39
Rate this:
Please Sign up or sign in to vote.
An ATL toolbox control.


This article presents a Toolbox control similar to the one used in Visual Studio .NET 2003. The main target was to achieve maximum similarity with the VS.NET Toolbox object model and GUI behaviour. It is written as an ATL ActiveX control using WTL 7.5 and STL and ATL collections.


Because I couldn't find such a control on the Internet, I decided write it myself. In the beginning, I had to fight with the GUI, but when I found a great article MS Access Bar written by Bjarke Viksoe, the fight was done.

I do not have much time to completely describe each and every method of all interfaces, but I'll give you a short overview. This version of the Toolbox contains some bugs that I have not fixed (moving tabs by selecting Move up/down from popup menu... try and you will find them) and the work is not finished yet, because of lack of time - but I am working on it.


The Toolbox is a classic full ATL control. For my requirements I had to extend Bjarke Viksoe's MS Access Bar control (I have changed the code for drawing tabs and have added some helper methods).

The Toolbox control consists of six interfaces:

  • IToolbox
  • IToolBoxTab
  • ITooBoxItem
  • IToolBoxTabs
  • IToolBoxItems
  • IToolboxEvents

Interfaces related to the GUI


Represents the main control.


Represents a Toolbox tab object. You can rearrange tab positions by dragging them with mouse or by choosing the appropriate command from the popup menu (this does not work correctly).


Represents a Toolbox tab item object.

There are four kinds of tab items (the names are borrowed from VS.NET 2003 Toolbox, and they are self describing I think Smile | :)

  • ToolBoxItemFormatText - As a data contains text value, and displays "text" icon.
  • ToolBoxItemFormatHTML – As a data contains text value, and displays "html" icon.
  • ToolBoxItemFormatGUID – An ActiveX control, as a data contains the GUID of a control and displays the icon from a control DLL.
  • ToolBoxItemFormatPointer – displays "arrow" icon, data property is empty.

The functionalities of the described interfaces are nearly the same as that of VS.NET 2003 toolbox interfaces, with some extra methods and properties. Interface IToolboxEvents is a dispatch event interface.

Collection and enumerator interfaces

There are two collections and enumerator interfaces (more on this kind of interfaces is described in this article):


Collection of Toolbox tab objects.


Collection of Toolbox tab item objects.

These interfaces allow you to manipulate an object from Visual Basic (or VB script) using For..Next and For...Each syntax:

Private Sub Form_Load()
Dim tab As ToolBoxTab
  Set tab = Toolbox1.ToolBoxTabs.Add("Tb 1")
  For Each tab In Toolbox1.ToolBoxTabs
    tb.Name = "Tab"
End Sub


There is an event dispatch interface IToolboxEvents, and it is related to the Toolbox object.

Property pages

In this version, the Toolbox has its own property page for enabling a popup menu and its "customize" menu item. It has a stock font property page as well.

Popup menu

There are two different popup menus for the Tab and the Tab Item. For the Tab Item, you can cut, copy and paste the Tab Item or paste text from the clipboard to the Toolbox as the Tab Item of type ToolBoxItemFormatText.



  • October 07th, 2005 – Initial version.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Jozef Bozek
CEO bring-it-together s.r.o.
Slovakia Slovakia
Jozef Božek is currently a software engineer at bring-it-together s.r.o. in area of large scale infomation systems and mobile applications development.
He has been developing in C++ nearly full time since 2000, in Java since 2004 and in Objective-C since 2009. He is programming using Java EE SDK, iOS SDK, COM/DCOM, MFC, ATL, STL and so on Smile | :)

You may also be interested in...

Comments and Discussions

Generalcannot open include file 'atlres.h'. Pin
luibaiyi29-Jul-07 21:38
memberluibaiyi29-Jul-07 21:38 
GeneralCant compile.... Pin
daveice30-Mar-06 3:59
memberdaveice30-Mar-06 3:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151002.1 | Last Updated 4 Oct 2005
Article Copyright 2005 by Jozef Bozek
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid