Duplicate menu items in the Window CMFCMenuBar

I have ported the MFC application to the Feature pack. When I try to insert a new submenu / popup menu in the CMFCMenuBar, the menu items in the Window menu are duplicated. Please help me. I used the below code to insert a submenu.

    CMenu* pMenu;
    HMENU hMenu = m_wndMenuBar.GetHMenu();

ASSERT(::IsMenu(hMenu));
pMenu = CMenu::FromHandle(hMenu);

pMenu = pMenu->GetSubMenu(2);   
pMenu->InsertMenu(2, MF_BYPOSITION ,
    (UINT)ID_SORTING_SORTBYACCESS, _T("My Menu"));

m_wndMenuBar.CreateFromMenu(hMenu, false, true);

      

+3


source to share





All Articles