void CMainFrame::OnReplaceMenu() { // Load the new menu. m_NewMenu.LoadMenu(IDR_SHORT_MENU); ASSERT(m_NewMenu); // Remove and destroy the old menu SetMenu(NULL); ::DestroyMenu(m_hMenuDefault); // Add the new menu SetMenu(&m_NewMenu); // Assign default menu m_hMenuDefault = m_NewMenu.GetSafeHmenu(); // or m_NewMenu.m_hMenu; }
{
// Load the new menu.
m_NewMenu.LoadMenu(IDR_SHORT_MENU);
ASSERT(m_NewMenu); // Remove and destroy the old menu
SetMenu(NULL);
::DestroyMenu(m_hMenuDefault); // Add the new menu
SetMenu(&m_NewMenu); // Assign default menu
m_hMenuDefault = m_NewMenu.GetSafeHmenu(); // or m_NewMenu.m_hMenu;
}