How to set the initial positions of toolbars when the application starts for the first time?

Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

When your application runs for the first time, toolbars are docked in their default positions. You can set these positions in, for example, the CMainFrame:OnCreate() method. You can dock some toolbars in a particular row. You can dock some other toolbars in their own separate rows. The following code demonstrates this idea:

// Dock m_wndToolBar1 in row 1
DockControlBar(&m_wndToolBar1); // Docked in row 1
RecalcLayout();
 
// Dock m_wndToolBar2 in row 1 next to m_wndToolBar1
CRect wrAlreadyDockedBar;
m_wndToolBar1.GetWindowRect( &wrAlreadyDockedBar );
wrAlreadyDockedBar.OffsetRect( 1, 0 );
DockControlBar(&m_wndToolBar2,AFX_IDW_DOCKBAR_TOP,&wrAlreadyDockedBar);
RecalcLayout();
 
// Dock m_wndToolBar1 in row 2
DockControlBar(&m_wndToolBar3);
 
// Dock m_wndToolBar1 in row 3
DockControlBar(&m_wndToolBar4); 

Please note when the application runs for the second time, Prof-UIS restores toolbar positions saved in the registry before.