CMenu menu; BOOL b_test = menu.CreatePopupMenu(); if(!b_test) return 0; menu.AppendMenu(0, IDM_CLEAN, _T("clean")); menu.AppendMenu(0, IDM_EXIT, _T("exit")); menu.EnableMenuItem(IDM_CLEAN, MF_BYCOMMAND); menu.EnableMenuItem(IDM_EXIT, MF_BYCOMMAND); SetForegroundWindow(); menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this);