How to Help Your Business Become an AI Early Adopter
Allows user-customization (inserting, removing, reordering toolbar buttons) of the toolbar. Also remembers last position of the toolbar upon application exit.
While monitoring the MFC newsgroup, a friend and I noticed quite a few questions on customizable toolbars, so we went off and created a generic application supporting customizable toolbars. Unfortunately, I've just noticed that when customizing the toolbar while the toolbar is vertical causes incorrect repainting - to correct the toolbar display, simply float the toolbar, resize it (this corrects the painting), and then re-dock it. Customization is disabled while the toolbar is floating because we couldn't get the toolbar to repaint correctly (since the customizable toolbar wasn't part of our project, we didn't feel terribly motivated to perfect our generic application - but this project could serve as an excellent springboard to get developers to the point of customizable toolbars).
Warning: To make the creation of the toolbar a little easier, I've overridden CToolBar::Create in order to default some of the arguments. In doing so, I don't think you can simply drop this class in where you used to have CToolBar's - but it's only a few lines away from a drop-in. Also, in MainFrm.cpp, you'll notice a block of code declaring CMainFrame::mainToolBar. This is a collection of data needed to inform the toolbar what buttons are available to the toolbar and their default ordering on the toolbar.