Popup menu clicking the right mouse button 
Author Message
 Popup menu clicking the right mouse button
Hi all.
Is there a way to make a poupmenu appear clicking the right mouse
button. I've create the menu in .rc file and I want to show it.
Thanks in advance
Stefano



Sun, 05 Jan 2003 03:00:00 GMT  
 Popup menu clicking the right mouse button
Hi,
you can try this code
Cmenu menu;
VERIFY(menu.load(IDR_MENU1));
CMENU* pPopup=menu.get submenu(0);
ASSERT(pPopup!=NULL);
Ppopup->Trackpopupmenu(TPM_LEFTALIGN)
TPM_RIGHTBUTTON,X,Y,AFX GETMAINWND())
Hope this helps:)
Pamela



Quote:
> Hi all.
> Is there a way to make a poupmenu appear clicking the right mouse
> button. I've create the menu in .rc file and I want to show it.
> Thanks in advance
> Stefano

Sent via Deja.com http://www.deja.com/
Before you buy.


Sun, 05 Jan 2003 03:00:00 GMT  
 Popup menu clicking the right mouse button

Try overloading the WM_CONTEXTMENU message in your view, and then use the
code suggested by Pamela.

The code will look something like this:

CMyView::OnContextMenu(CWnd *pWnd, CPoint point)
{
    CPoint local = point;

  GetParentFrame()->ActivateFrame();
  ScreenToClient(&local);

 // Load menu from Resource
 CMenu menu;
 LoadProperMenu(local, menu);

 // Get popup menu from first submenu
 CMenu *pPopup = menu.GetSubMenu(0);
 ASSERT_VALID(pPopup);

 // Display Popup menu
 pPopup->TrackPopupMenu(TPM_LEFTALIGN |TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
  point.x, point.y, AfxGetMainWnd());

Quote:
}

Michael


Quote:
> Hi all.
> Is there a way to make a poupmenu appear clicking the right mouse
> button. I've create the menu in .rc file and I want to show it.
> Thanks in advance
> Stefano



Sun, 05 Jan 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. adding popup to right click menu options

2. assertion error when right click popup menu

3. Right click popup menus

4. CRichEditCtrl right click popup menu 's cursor

5. Beginner Question - Popup menu on right click with item submenus

6. Create a right click popup menu

7. adding popup to right click menu options

8. Creating Right-Click Popup Menu in List Box

9. Popup menu from right click

10. MSagent, Managing right click contextual popup menu !

11. Insert a New Item to the right mouse windows - explorer popup menu

12. how to close a right mouse popup menu?

 

 
Powered by phpBB® Forum Software