.h文件
protected:
afx_msg void OnNMRClick(NMHDR *pNMHDR, LRESULT *pResult);
.cpp文件
BEGIN_MESSAGE_MAP(CDemoDlg, CPropertyPage)
ON_NOTIFY(LVN_COLUMNCLICK, IDC_LIST1, OnColumnClick)
END_MESSAGE_MAP()
void CDemoDlg::OnNMRClick(NMHDR *pNMHDR, LRESULT *pResult)
{
CMenu popMenu;
popMenu.LoadMenu(IDR_MENU1);
CPoint posMouse;
GetCursorPos(&posMouse);
CMenu* pSubMenu = NULL;
pSubMenu = popMenu.GetSubMenu(0);
pSubMenu->TrackPopupMenu(0, posMouse.x, posMouse.y, this);
*pResult = 0;
}