Click to See Complete Forum and Search --> : toolbar


May 15th, 1999, 03:32 PM
how do I disable the toolbar at startup? in other words how do I start my application with the toolbar hidden?

Dan Haddix
May 15th, 1999, 10:03 PM
If you just want to hide the toolbar add this line right before the return statement in the OnCreate() function of your main frame class

ShowControlBar(&m_wndToolBar, 0, 0);

or if you don't want the toolbar at all you can get rid of it by deleteing the following lines from the OnCreate function

if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}

m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);

This has the side effect of leaving the toolbar option on the view menu. If you want to get rid of it completely you can start a new appwizard project and uncheck the toolbar option in the 4th dialog.