user3621602
user3621602

Reputation: 73

context menu does not show up

In my application i want to have two context menus, which appear on mouse right click dependent on the area where the click was made.

first one was generated by the compiler (visual studio 2010) IDR_POPUP_EDIT. i just added there two additional buttons and it just worked. second one i wanted to create from scratch, so i prepared the IDR_PGRC menu resource, which has identical properties and has 2 buttons. In case when there was click on the right side of the frame the idr_popup_edit should appear and the idr_pgrc otherwise.

I'm positive, that the OnRButtonUp and OnCOntextMenu functions are called each time there was a right click on the frame, however, the IDR_PGRC never show up.

this is how i handle the context menu showing up:

#ifndef SHARED_HANDLERS
theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);    
DEB("ending\n");
#endif

and accordingly:

#ifndef SHARED_HANDLERS
theApp.GetContextMenuManager()->ShowPopupMenu(IDR_PGRC, point.x, point.y, this, TRUE);
#endif

Can anyone provide me any hint want i may be doing wrong?

Upvotes: 1

Views: 869

Answers (1)

noelicus
noelicus

Reputation: 15055

If you created it yourself you most likely should be passing it the HMENU hmenuPopup rather than a resource ID.

(If that's not it then please post your code for creating the menu.)

So if you create your menu with CreatePopupMenu, add your items to it then call the overloaded ShowPopupMenu where you can pass the menu handle (CMenu::GetSafeHMenu).

Upvotes: 1

Related Questions