This is my menu structure in the Resource Editor:
I have had to add a ITEMS entry to all of my flyout menus. Then, when creating my menu to display it:
CMenu mnuContext, *pMnuPopup = nullptr, *pMnuSwap = nullptr, *pMnuChairman = nullptr;
mnuContext.LoadMenu(IDR_MENU_MWB_SWAP);
pMnuPopup = mnuContext.GetSubMenu(0);
if (pMnuPopup == nullptr)
return;
pMnuSwap = pMnuPopup->GetSubMenu(0);
//# TODO Why is it I have to go through mnuContext / pMnuPopup / pMnuSwap to get to pMnuSwap?
if (pMnuSwap == nullptr)
return;
// Extract all the flyout menus
pMnuChairman = pMnuSwap->GetSubMenu(SwapAssignment::Chairman);
// Remove the placeholders (these were added with Resource Editor)
if(pMnuChairman != nullptr)
pMnuChairman ->DeleteMenu(0, MF_BYPOSITION);
// Now we can populate the popup menu.
Why do I have to add this dummy menu entry in the editor? I find that if I do not add an entry then the menu returned (pMnuChairman
) is nullptr
. If I add the dummy entry, then I get a valid menu object and can proceed.
Why do I have to do this?
The major problem is that a sub menu is defined by its sub menu entries. There is nothing like an empty menu.
Also the resource compiler don't allow this.
It is just the way how the Windows resource stuff was designed and never really reviewed.