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

CMDIFrameWnd::CreateClient

Creates the MDI client window that manages the CMDIChildWnd objects.

virtual BOOL CreateClient(
   LPCREATESTRUCT lpCreateStruct,
   CMenu* pWindowMenu 
);

Parameters

lpCreateStruct
A long pointer to a CREATESTRUCT structure.
pWindowMenu
A pointer to the Window pop-up menu.

Return Value

Nonzero if successful; otherwise 0.

Remarks

This member function should be called if you override the OnCreate member function directly.

Example

// The code below is from winmdi.cpp. It shows how to 
// call CMDIFrameWnd::CreateClient(). CMainFrame is a 
// CMDIFrameWnd-derived class.
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
   CMenu* pMenu = NULL;
   if (m_hMenuDefault == NULL)
   {
      // default implementation for MFC V1 backward compatibility
      pMenu = GetMenu();
      ASSERT(pMenu != NULL);
      // This is attempting to guess which sub-menu is the Window menu.
      // The Windows user interface guidelines say that the right-most
      // menu on the menu bar should be Help and Window should be one
      // to the left of that.
      int iMenu = pMenu->GetMenuItemCount() - 2;

      // If this assertion fails, your menu bar does not follow the guidelines
      // so you will have to override this function and call CreateClient
      // appropriately or use the MFC V2 MDI functionality.
      ASSERT(iMenu >= 0);
      pMenu = pMenu->GetSubMenu(iMenu);
      ASSERT(pMenu != NULL);
   }

   return CreateClient(lpcs, pMenu);
}

See Also

CMDIFrameWnd Overview | Class Members | Hierarchy Chart | CMDIFrameWnd::CMDIFrameWnd

Show:
© 2015 Microsoft