I want to dock CDialogBar to the top of window in the code, and after that how can I make it impossible to dock-undock it with the mouse when app is running?

When I write

DlgBar->EnableDocking(CBRS_ALIGN_TOP);
MainFrame->DockControlBar(DlgBar, AFX_IDW_DOCKBAR_TOP);
DlgBar->EnableDocking(0);

It is placed at the top, as I wanted, but I can undock it with the mouse, and after that it can't dock to any side. How can I prevent it from being undocked?