Click here to Skip to main content
15,909,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can any one give me a sample code for inserting a Menu on the Dialog using MFC CMenu class.

Thanks
Abhi
Posted

When I was doing MFC, I just used the designer and drag/dropped a menu control onto the dialog box...
 
Share this answer
 
Thanks

Well,, I want to load my menu dynamically.
 
Share this answer
 
You can start like this:

CMenu menu;
menu.CreatePopupMenu();
menu.AppendMenu(MF_STRING,ID__OPTION1,"First option" );
menu.AppendMenu(MF_STRING,ID__OPTION2,"Second option" );
::SetForegroundWindow(m_hWnd);
TrackPopupMenu(menu,TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,NULL, m_hWnd,NULL);
::SetForegroundWindow(m_hWnd);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900