Здравствуйте, Женя, Вы писали:
Ж>CMenu pMenu;
Ж>pMenu.CreatePopupMenu();
Ж>UINT_PTR i = ID_FIRST_MENU_ITEM;
Ж>for(TelList::iterator iter = telList->begin(); iter != telList->end(); iter++) {
Ж> // строим строку item
Ж> pMenu.AppendMenu(MF_STRING, i++, (LPCTSTR)item);
Ж>}
Ж>CPoint posMouse;
Ж>GetCursorPos(&posMouse);
Ж>pMenu.TrackPopupMenu(0, posMouse.x, posMouse.y, m_hWnd);
Самый простой способ:
UINT_PTR cmdRet = (UINT_PTR)pMenu.TrackPopupMenu(TPM_RETURNCMD, posMouse.x, posMouse.y, m_hWnd);
MSDN:
If you specify TPM_RETURNCMD in the uFlags parameter, the return value is the menu-item identifier of the item that the user selected. If the user cancels the menu without making a selection, or if an error occurs, then the return value is zero.