1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
void CMenusDlg:: OnContextMenu(CWnd* pWnd, CPoint point)
{
// TODO: Add your message handler code here
///////////////////////
// MY CODE STARTS HERE
///////////////////////
// Declare local variables
CMenu *m_lMenu; // A pointer to the menu
CPoint m_pPoint; // A copy of the mouse position
// Copy the mouse position to a local variable
m_pPoint = point;
// Convert the position to a screen position
ClientToScreen(&m_pPoint);
// Get a pointer to the window menu
m_lMenu - GetMenu();
// Get a pointer to the first submenu
m_lMenu = m_lMenu->GetSubMenu(0);
// Show the Popup Menu
m_lMenu->TrackPopupMenu(TPM_CENTERALIGN + TPM_LEFTBUTTON,
m_pPoint.x, m_pPoint.y, this, NULL);
///////////////////////
// MY CODE ENDS HERE
///////////////////////
} |
Partager