Code to Dynamically Redock a Toolbar at Runtime

This is a simple code snippet that enables you to dyamically enable docking and then dock any
toolbar at runtime. To use (or test) this code, simply add the following code
to a COMMAND message handler such as OnChangeToolBar and the code will allow you to
re-dock any undocked toolbars. Obviously, one way of implementing this would be to have
a function that allows novice end-users that get happy with their mice to reset, or redock all toolbars
at once. In that case, you could simply keep the toolbar ids in an array and iterate through them,
redocking each one.

void CMainFrame::OnChangeToolBar()
AfxMessageBox(“Error: could not load toolbar”);


More by Author

Must Read