Advertisement

Popup Menu not popping up ;(

Started by April 11, 2000 10:37 PM
3 comments, last by narlymon 24 years, 8 months ago
Hi, all. This is straight from the book. It compiles fine, but when I run it and click the RMB, no popup menu appears. What gives? CMenu * g_pmenuContext; CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ... g_pmenuContext = new CMenu(); if (!g_pmenuContext) return -1; BOOL bSuccess = g_pmenuContext->LoadMenu(IDR_MENU1); if (!bSuccess) return -1; ... } void CMainFrame::OnRButtonDown(UINT nFlags, CPoint point) { ClientToScreen(&point); CMenu * psubmenu = g_pmenuContext->GetSubMenu(1); psubmenu->TrackPopupMenu(TPM_LEFTALIGN /TPM_RIGHTBUTTON, point.x, point.y, this); CFrameWnd::OnRButtonDown(nFlags, point); } Thanks
Hi!

You need to handle the WM_CONTEXTMENU message.

void CMyView::OnContextMenu(CWnd* pWnd, CPoint point){    CMenu menu;    menu.LoadMenu(IDR_MYFLOATINGMENU);    menu.GetSubMenu(0)->TrackPopupMenu(.......);} 


*Sparkle*


Edited by - Sparkle on 4/12/00 5:24:44 AM
Advertisement
Do I handle the WM_CONTEXTMENU message in addition to the WM_RBUTTONDOWN message or instead of it?
Instead of it.

*Sparkle*
Got it working. . . Thanks!

This topic is closed to new replies.

Advertisement