Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Menu in MDI Appication

Status
Not open for further replies.

raochetan

Programmer
Aug 20, 2001
62
IN
I have a couple of questions.

1. In am MDI application, how to access the Menu from a view class? I want to display a pop-up menu on right click of the mouse.

2. How to hide a pop-up menu item(s) when the MDI application is loaded? I want them to be visible only if certain condition is met.

Thanks in advance.

regards
rcs



 
For 1
I used the class wizard to add a message map to the view
for WM_CONTEXTMENU
I used that to launch a menu, with message maps created as normal

Code:
void CDataView::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	CMenu theMenu;

	theMenu.LoadMenu(IDR_VIEW_POPUP);
        //the 0 is the offset of the popup wanted
        //on the menu bar
	theMenu.GetSubMenu(0)->TrackPopupMenu(TPM_CENTERALIGN,point.x,point.y,this);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top