1
votes

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..

2

2 Answers

1
votes

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

1
votes

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