Original article on codeproject

download latest version of Toolbar Editor

download WIP version of Toolbar Editor (2005/10)

If you want, you can send a donation with paypal.


I usually spend a lot of time to give to my projects a nice and user friendly GUI. In my opinion in all desktop projects it's "almost" mandatory to give to the user something that can speed-up all functions that are frequently used. The simpler( and most used) method is to build a toolbar.
Visual studio come itself with a toolbar editor but, really, I hate it: It's still limited to 16 colors, it can't load external images and avery time you want to add a new button is a pain. For all these reason I wrote my own toolbar editor for visual studio IDE.
Toolbar editor screeshot


Simply run the setup and follow the on-screen instruction (nothing more than the usual: next,next,yes, yes, next finish ;)). The setup utility of Toolbar Editor (TE) will also create two subdirectory: temp and imgLib .
You can put in the imgLib directory all icons / images that you frequently use to build your toolbars: they will be displayed and previewed in TE so you can easly drop them in the toolbar on wich you are currently working on.
You should also copy your afxres.h file in the main application directory. See " Limitations of the toolbar editor " section for more informations.
In my original plans it would have to be a real add-in of visual studio, but the extensibility templates are disabled in my VC++ std, so I started to write an external tool. Despite this, you can still use TE while your project is open: after you have commit the changes the IDE will ask you to reload the modified files.

How it works

You can start to edit toolbars in tree steps:
a) Open the resource file (.rc) of the project that you want to edit
b) Select the resource ID from the combo box
c) Click on "scan" to get the preview of currently loaded toolbar

Now you can add new buttons, move around the existing ones and so on. Both the toolbar and the listbox used for preview supports drag & drop so you can easily move buttons using your mouse. On the right side of the dialog window, there is a listbox that you can use as a library: it reads all supported types of images from a folder (if you want you can change it in the Options) so you can take them and drop on the toolbar (you can also drop new images from the Explorer window). If the image loaded is too big (or too small), you can use the Resize function from the main menu.

When your toolbar is ready, you can click on the "Generate" button to merge it in your project: all needed IDs will be created and added to the resource.h file. If you don't want to modify your project files, you can disable this feature and the new files will only be created in the temp folder of the editor. By default, the bitmap generated has a 4 bit color depth (16 colors) to mantain the preview active in the visual studio editor also but it's possible to create a grayed and true color bitmap.

The bitmaps will be created in the ./res folder of the currently open project. By default, their names are the same as the toolbar's bitmap with the _TC and _GR suffix, but you can change both the destination folder and the name. You can add these bitmap on your project and then use them with some true color toolbar class like Dany Cantin's CTrueColorToolbar .
Let's say that YOUR_BITMAP_TC , YOUR_BITMAP_HT and YOUR_BITMAP_GR are the IDs of these bitmaps, then you can use them in your OnCreate like:




You should always create the true color bitmap because when you will open again the toolbar for editing, it will be used to create the imagelist instead of the 16 color version. Note that this will works only if the true color bitmap is saved using the default name bitmap_name_TC.bmp .
Finally, if you need only the imagelist, you can save it using the Save button in the bitmap section. This won't update .rc or resource.h in your project.

Creating new toolbars

Even if you are creating a new toolbar you need a resource file to put it in. For this reason remember to open the right resource file before starting to work on new toolbar. After you select "New" on "File" menu (or you clicked on "new" button in the main TE toolbar) Toolbar Editor will ask for essential info about toolbar: ID, size and type (Visual C++ .net or Visual C++ 6).

You can choose a new ID also (not previously defined in your resource.h but be carefull: TE won't check if what you typed it's a valid ID name so avoid spaces, special chars and so on...
After this point you can work as previously described and, when you are ready, merge the toolbar with the "generate" button or copy the toolbar code to clipboard using the menu entry Tools->Toolbar->Copy to clipboard


Limitations of the toolbar editor

There are some considerations about IDs. My editor reads the toolbar structure from the .rc file and the IDs defined in your project in the resource.h file: it doesn't know anything about any other IDs! So be careful when you edit IDs in the Toolbar editor: if you use an ID already defined somewhere else than resource.h , it can be a problem! Just a note: the setup package doesn't come with afxres.h because I don't know if that file is copyrighted by MS and/or if it's redistributable. You should copy it to the TE main folder so it will be also be parsed to avoid double definitions. In IDs' combobox are listed all IDs in your resource.h (but there you can use the "autocomplete" feature to search for the right one). Maybe in future, I will add some sort of filter to display only the toolbars.
To put in your .rc file new toolbars, TE use as marker this text: // Toolbar . If TE can't find the marker in your file, the merging of new toolbars will fail(note that this is a problem only for new toolbars).


My work was inspired by Tomkat's [ ^ ] great tool ( Super ImageList and ToolBar generator [ ^ ]) that helped me a lot in the imagelist creation last year. I wish to also thank:


  • 1.0 - (2005/08/02).
    • First public release.
  • 1.1 - (2005/08/03).
    • Fixed some compatibility issue with VC6.
  • 1.2 - (2005/08/05).
    • Now it's possible to parse more files with IDs.
    • Linked statically to avoid dependency problems.
    • Changed true color bitmap generation checkbox to true as default.
    • Now, if available, true color bitmap is used to create the imagelist when a toolbar is opened.
    • Disabled "error diffusion" in 16 color bitmap creation.
  • 1.3 - (2005/09/12).
    • Added "new" toolbar feature
    • Added hot imagelist creation
    • Added some accelerators
    • Added MRU list
    • Improved drag and drop (now you can use it to move buttons also and replace only image holding CTRL key)
    • Fixed bug when two buttons have the same ID
  • 1.3b - (2005/10/27).
    • Added check for updates routine
    • Fixed bug caused by MRU implementation (crash on startup)
    • Fixed bug with 16 colors bitmap (ugly view in preview)
  • 1.4 - (2007/01/09). **SHIPON**
    • Added filter to IDS (now will be showed only toolbars' IDs)
    • Added filter on edit box to avoid invalid IDs
    • Fixed various issues during linking
    • Minor bug fixes


This program is free and provided "as is" without any express or implied warranty.
Use at your own risk!

Download Toolbar Editor
Discussion Board

IlPanda Soft 2001-2005 Webmaster Arf