locked
Change top level menu with MFC in CE 6.0 RRS feed

  • Question

  • Hi

       I have tried every which way to change the top level menu in my application including Microsoft's example

       // Load the new menu.
       m_NewMenu.LoadMenu(IDR_LOG_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;
    

    This code does destroy the existing menu and create just a grey bar.   However the IDR_LOG_MENU does

    not appear.

      Also  the following code does not function either.  IE a File selection never appears on the main menu.

    CMenu msubment;  //declared globally

        CMenu* mmenu = GetMenu();

        msubmenu.CreatePopupMenu();

        msubmenu.AppendMenu(MF_STRING, ID_SUB_EXIT, _T("Exit"));

        mmenu->AppendMenu(MF_STRING, (UINT) msubmenu.m_hMenu, _T("File"));

       

    I have been able to modify the submenus of the existing main menu,  similar to the example dynamenu.

    Does anyone know how to add a selection to the top level menu dynamically ???

    Thursday, April 12, 2012 4:25 PM

All replies

  • You can change the sub menu but hard to change the top menu.

    NEU_ShieldEdge

    Monday, April 16, 2012 8:01 AM