You can remove a menu item, and any pop-up menus associated with that item, by using the DeleteMenu function. DeleteMenu permanently removes the specified menu item from the specified menu, and moves subsequent items up to fill the gap.
DeleteMenu (hFruitMenu, /* handle to menu */
1, /* delete the second item */
MF_BYPOSITION); /* we are specifying the
item by its position
on the menu */
This example deletes the Fruit menu's second item. Windows moves any subsequent items up to fill the gap.
The following example deletes the same item, but specifies it by its menu ID rather than by its position on the menu:
DeleteMenu (hFruitMenu, /* handle to menu */
IDM_ORANGES, /* delete “Oranges” item */
MF_BYCOMMAND); /* we are specifying the
item by its menu ID */