Win95 - Adding a toolbar
Use the resource editor to draw out you toolbar. Give it a resource ID and then go to MainFrame::Create to create the toolbar.
Create the toolbar and load the icons in one go. If either of these fail then the toolbar won't work.
if (!m_oMeterToolbar.Create(this,WS_CHILD | WS_VISIBLE | CBRS_TOP,IDR_BAR1 ) || !m_oMeterToolbar.LoadToolBar(IDR_BAR1)) { TRACE0("Failed to create other toolbar\n"); return -1; // fail to create }
// Set the toolbar style options m_oMeterToolbar.SetBarStyle(m_oMeterToolbar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// A special one !! Set the toolbar flat, just like dev studio ! m_oMeterToolbar.ModifyStyle(0,TBSTYLE_FLAT); // Give the toolbar the ability to Dock m_oMeterToolbar.EnableDocking(CBRS_ALIGN_ANY); // Give the MainFrame the ability to have docking toolbars EnableDocking(CBRS_ALIGN_ANY); // And dock it ! DockControlBar(&m_oMeterToolbar);
Thats all there is to it !