You cannot use LoadMenu, since this function does just that.
After changing the loaded menu, it will be destroyed when the menu object used for loading goes out of scope. You must change the menu that is currently in use.
Your menu is a pop-up part of the main menu, the second in position. It contains 5 elements, and the second one has another popup. As far as I understand, you want to remove this item and the popup for this item. To make it work, you will need to ask the main window for the current menu:
CMenu* pMenu = GetMenu();
Of course, this code is from the main frame. If you want to use it elsewhere, you will have to access everyone by pointing to the main frame.
Johnz
source share