Thursday, March 08, 2007

Display the Popup menu at Mouse click point

On the Left mouse button click, at the click point we have to display the
popup menu...


void CMyDlg::OnLButtonDown(UINT nFlags, CPoint point)
{


m_PopupMenu.LoadMenu(IDR_POPUP);

CMenu* pSub = m_PopupMenu.GetSubMenu(m_iMenuIndex);


ClientToScreen(&point);

TrackPopupMenu(pSub->GetSafeHmenu(), TPM_LEFTALIGN |

TPM_LEFTBUTTON, pt.x, pt.y, NULL, m_hWnd, NULL);

}

No comments: