Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » My app has three menus and I change some menu item during running,after exit app,it raise an err. Collapse All
Subject Author Date
thomas huang Jan 1, 2004 - 5:47 AM

It calls the following code and tells me Assert failed. Why?


void CFrameWnd::OnDestroy()
{
 DestroyDockBars();


 // reset menu to default before final shutdown
 if (m_hMenuDefault != NULL && ::GetMenu(m_hWnd) != m_hMenuDefault)
 {
  ::SetMenu(m_hWnd, m_hMenuDefault);
  ASSERT(::GetMenu(m_hWnd) == m_hMenuDefault);
 }


 // Automatically quit when the main window is destroyed.
 CWinApp* pApp = AfxGetApp();
 if (pApp != NULL && pApp->m_pMainWnd == this)
 {
  // closing the main application window
  ::WinHelp(m_hWnd, NULL, HELP_QUIT, 0L);


  // will call PostQuitMessage in CWnd::OnNcDestroy
 }
 CWnd::OnDestroy();
}

Sergiy Lavrynenko Jan 3, 2004 - 10:40 AM

Dear Thomas,


I suppose your app uses a menu bar that simply kills the main frame’s menu and uses it to create its own buttons. Please provide me with more details or let me take a look at the source code or, at least, at the MainFrm.cpp and MainFrm.h files.


Best regards, Sergiy.