CMFCMenuButton not showing dropdownlist in release

放肆的年华 提交于 2019-12-12 04:35:44

问题


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:

Release build:

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:


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.



来源:https://stackoverflow.com/questions/18055963/cmfcmenubutton-not-showing-dropdownlist-in-release

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!