tags:

views:

290

answers:

2

I am working with a multiple top level windows application. The main window is a MDIFrameWnd, I put some code in CWinApp to switch m_pMainWnd when switch top level window. It's work fine but fire a assert when I close one of the main window. This assert is from CMDIChildWnd:

void CMDIChildWnd::AssertValid() const
{
    CFrameWnd::AssertValid();
    ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
}

It look like the window be closed release the shared menu. I try to find out where the menu is released in MFC framework, but can not find it. Could somebody help me? Thanks..

+1  A: 

The CMultiDocTemplate class has ownership over the shared menu (it destroys m_hMenuShared in it's destructor).

crimson13
+1  A: 

I found the problem is. A Menu bar control in main frame will destory menu in its dtor. Thanks every one.

shian