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

MainFrame->DockControlBar(DlgBar, AFX_IDW_DOCKBAR_TOP);

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?