CMDIFrameWnd::CreateClient
创建托管 CMDIChildWnd 对象的MDI客户端窗口。
virtual BOOL CreateClient(
LPCREATESTRUCT lpCreateStruct,
CMenu* pWindowMenu
);
参数
lpCreateStruct
为 CREATESTRUCT framework的较长的指针。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