本文原创转载请注明作者及出处
本文链接:http://blog.csdn.net/wlsgzl/article/details/42147277
-------------------------------------------------------------------
参数1:资源ID,参数2:该资源中菜单的位置。
void CXXXDlg::ShowRightMenu(UINT nIDResource,int nPos) { DWORD dwPos=GetMessagePos(); CPoint oPoint(LOWORD(dwPos),HIWORD(dwPos)); CMenu oMenu; oMenu.LoadMenuW(nIDResource); CMenu* poMenu=oMenu.GetSubMenu(nPos); poMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, oPoint.x, oPoint.y, this); }