creating pop-up menus with dialog based apps gets assert error 
Author Message
 creating pop-up menus with dialog based apps gets assert error

hi,

 the following example taken from the vc++ 5.0 complies fine but when it gets
to
the ASSERT it blows up with an ASSERT failure

/* from the resource file
IDR_MENU3 MENU DISCARDABLE
BEGIN
    MENUITEM "",                            IDR_MENU3, MENUBARBREAK
    MENUITEM "This is my pop up",           ID_MENUITEM32814, HELP
END
*/

void MyExample::OnContextMenu(CWnd* pWnd, CPoint point)
{

   CMenu MyMenu;

    VERIFY(MyMenu.LoadMenu( IDR_MENU3 ));
    CMenu *pPopMenu = MyMenu.GetSubMenu(0);
    ASSERT (pPopMenu != NULL);
    pPopMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTALIGN,
0,0,AfxGetMainWnd());

Quote:
}



Sat, 09 Dec 2000 03:00:00 GMT  
 creating pop-up menus with dialog based apps gets assert error

You did not check the Popup property in the Resource Editor. If you had the
menu resource would look like this:

Quote:
>IDR_MENU3 MENU DISCARDABLE

BEGIN
    POPUP "_POPUP_"
    >BEGIN
    >    MENUITEM "",                            IDR_MENU3, MENUBARBREAK
    >    MENUITEM "This is my pop up",           ID_MENUITEM32814, HELP
    >END
END

Good luck
--
Pete

Quote:

>hi,

> the following example taken from the vc++ 5.0 complies fine but when it
gets
>to
>the ASSERT it blows up with an ASSERT failure

>/* from the resource file
>IDR_MENU3 MENU DISCARDABLE
>BEGIN
>    MENUITEM "",                            IDR_MENU3, MENUBARBREAK
>    MENUITEM "This is my pop up",           ID_MENUITEM32814, HELP
>END
>*/

>void MyExample::OnContextMenu(CWnd* pWnd, CPoint point)
>{

>   CMenu MyMenu;

>    VERIFY(MyMenu.LoadMenu( IDR_MENU3 ));
>    CMenu *pPopMenu = MyMenu.GetSubMenu(0);
>    ASSERT (pPopMenu != NULL);
>    pPopMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTALIGN,
>0,0,AfxGetMainWnd());
>}



Sat, 09 Dec 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Pop up menu in Dialog based App

2. Dialog box pop-ups - SDI vs. MDI apps

3. Help pop-ups in MFC App

4. How to hide a messagebox before it pops up, in a dialog based app

5. Trapping popup menu on dialog app

6. Assert error when creating modeless dialog

7. Getting a wait cursor in dialog-based app

8. OnIdle not getting called in dialog based app.

9. How can I tell when a dialog based app gets hidden or exposed

10. Dialog based app menu

11. Dialog Based Apps - Menu & Windows :: MFC

12. trying to add menu to dialog based app

 

 
Powered by phpBB® Forum Software