WM_SYSCOMMANDEX
You can use the WM_SYSCOMMANDEX message in your CView class to allow the CView to modify its docking state programmatically. The CView sends this message to its current parent frame. The following code sends a message to the view’s parent frame.
 
using namespace nsSysCommandEx;
ScxInfo si(GetParentFrame()->m_hWnd);
si.m_dw[0]=SCXID_DOCKRIGHT;
GetParentFrame()->SendMessage(WM_SYSCOMMANDEX,
SCX_NEWFRAME,(LPARAM)si);
The following SCXID parameters are available and defined in <stingray-installdir>\Include\Toolkit\syscmdex.h.
Table 56 – SCXID Parameters 
SCXID parameter
Description
SCXID_MDICHILD
Float the view as an MDI child.
SCXID_MINMDICHILD
Minimize the view as an MDI child.
SCXID_MAXMDICHILD
Maximize the view as an MDI child.
SCXID_RESTOREDMDICHILD
Restore the view as an MDI child.
SCXID_DOCKED
Dock the view in the next docking position on the main frame.
SCXID_DOCKLEFT
Dock the view on the left side of the main frame.
SCXID_DOCKTOP
Dock the view on the top of the main frame.
SCXID_DOCKRIGHT
Dock the view on the right side of the main frame.
SCXID_DOCKBOTTOM
Dock the view on the bottom of the main frame.
SCXID_FLOATING
Float the view outside the main frame.