Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All


Creates a new child window.

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


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


The ID of shared resources associated with the child window.


The child window's menu.


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, 

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

© 2015 Microsoft