Export (0) Print
Expand All

CMDIFrameWnd::CreateNewChild

Creates a new child window.

CMDIChildWnd* CreateNewChild( 
   CRuntimeClass* pClass, 
   UINT nResource, 
   HMENU hMenu = NULL, 
   HACCEL hAccel = NULL 
);

pClass

The run-time class of the child window to be created.

nResource

The ID of shared resources associated with the child window.

hMenu

The child window's menu.

hAccel

The child window's accelerator.

Use this function to create child windows of an MDI frame window.

// CMainFrame is a CMDIFrameWnd-derived class, 
// OnNewDraw is a menu command handler, 
// CDrawFrame is a CMDIChildWnd-derived class. 
void CMainFrame::OnNewDraw()
{
   CreateNewChild(RUNTIME_CLASS(CDrawFrame), IDR_DRAW, m_hDrawMenu, 
      m_hDrawAccel);
}

This example is an excerpt from Knowledge Base article Q201045, "HOWTO: Add Multiple Window Types to a Non-Document/View MDI App." Knowledge Base articles are available in the MSDN Library Visual Studio documentation or at http://support.microsoft.com.

Header: afxwin.h

Show:
© 2014 Microsoft