共用方式為


CMDIFrameWnd::CreateClient

建立處理 CMDIChildWnd 物件的 MDI 用戶端視窗。

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

參數

  • lpCreateStruct
    CREATESTRUCT 結構的長度的指標。

  • pWindowMenu
    對於 Windows 快顯功能表的指標。

傳回值

如果不是零,則成功,則為 0。

備註

這個成員函式,如果您直接,覆寫 OnCreate 成員函式應該呼叫。

範例

// 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);
}

需求

Header: afxwin.h

請參閱

參考

CMDIFrameWnd 類別

階層架構圖

CMDIFrameWnd::CMDIFrameWnd