Partager via


CMDIFrameWnd::CreateNewChild

Creates a new child window.

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

Parameters

  • 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.

Remarks

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

Example

// 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 https://support.microsoft.com.

Requirements

Header: afxwin.h

See Also

Reference

CMDIFrameWnd Class

Hierarchy Chart

Other Resources

CMDIFrameWnd Members