buttondrop-down-menumenumfccmfcmenubutton

CMFCMenuButton not showing dropdownlist in release


I have a CMFCMenuButton on a CDialogBar that has a very strange behaviour: it shows its dropdown list in the Debug build but does not show it in the Release build.

Debug build:

enter image description here

Release build:

enter image description here

It seems that there is happening something wrong in the call of __super::OnShowMenu() of the OnShowMenu() method of my derived class.

To make thing worse, there is some configuration on my machine that is not stepping into the MFC feature pack methods ... I made everything to put this working and I could not get there.

Please help.


Solution

  • Sorry, it was my mistake:

    On my derived class OnShowMenu function, I had to replace:

    pMyMenu= new CMenu;
    ASSERT(pMyMenu->CreatePopupMenu());
    this->m_hMenu= pMyMenu->GetSafeHmenu();
    

    with this:

    pMyMenu= new CMenu;
    pMyMenu->CreatePopupMenu();
    this->m_hMenu= pMyMenu->GetSafeHmenu();
    

    Yes, the bug was caused by the ASSERT.