CMFCMenuButton not showing dropdownlist in release

2019-08-31 01:55发布

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.

1条回答
Ridiculous、
2楼-- · 2019-08-31 02:20

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.

查看更多
登录 后发表回答