Create a new class derived from CWnd. Let's call it CMDIClient. 

Add a member variable of CMDIClient to your CMDIFrameWnd derived class, in this case CMainFrame: 

#include "MDIClient.h" 

class CMainFrame : public CMDIFrameWnd 

    { 

    ... 

    protected: 

    CMDIClient m_wndMDIClient; 

Override CMDIFrameWnd::OnCreateClient in your CMainFrame class and subclass the existing client window that CMDIFrameWnd owns: 

bool CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 

    { 

    if ( CMDIFrameWnd::OnCreateClient(lpcs, pContext) ) 

        { 

        m_wndMDIClient.SubclassWindow(m_hWndMDIClient); 

        return TRUE; 

    } 

    else 

    return FALSE; 

Add a handler for the WM_ERASEBKGND message to CMDIClient to handle background painting.