avatar  


Recently viewed tickets

Log out

How can I add to my program context menus?

In the Resource Editor, create a new menu resource (e.g. IDR_MYMENU). If this menu needs to be customizable, add it to your context menu customization manager (CMyApp::PreLoadState ()):

void CMyApp::PreLoadState()
{
    ...
    AddMenu(_T("Menu Name"), IDR_MY_MENU);
}


Add WM_CONTEXTMENU handler to your CWnd/CView- derived class:

void CMyView::OnContextMenu(CWnd*, CPoint point)
{
    theApp.ShowPopupMenu(IDR_MY_MENU, point.x, point.y, this)
}
Creation date: 10/16/2016 11:43 AM ()      Updated: 12/4/2024 8:54 PM (support)