I use two class in a none doc\view application. The first one is derive from CMDIChildWnd and the second one is derive from CView. I Create the CMDIChildWnd this way :
The CView derived class is create this way :HTML Code:pFrame->CreateNewChild( RUNTIME_CLASS(WndGridChild), IDR_INTERFTYPE, m_hMDIMenu, m_hMDIAccel);
When I create this window I don't why it call 2 times all functions for View creation ( OnInitialUpdate, PreCreateWindow, Constructor etc ).Code:BOOL WndGridChild::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { if (m_GridView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) return TRUE; return CMDIChildWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); } BOOL WndGridChild::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { pContext->m_pNewViewClass = RUNTIME_CLASS(CGridView); m_GridView = (CGridView*)CreateView(pContext); if(NULL == m_GridView) { return FALSE; } return CMDIChildWnd::OnCreateClient(lpcs, pContext); }
Evedently I would like it call it one time.
Thank you




Reply With Quote