views:

349

answers:

3

Is it possible to put a menu in a dialog based application? How?

+1  A: 

Yes, it is possible to add menu to the dialog based applications. You can create the menu as a resource and attach the same to the dialog.

If you open the properties for dialog, you can see a Menu as a property for which you can assign an existing Menu ID.

Steps:

  • Right click on Resource View and insert a new Menu. (Menu with some ID-- lets say IDR_MENU1 -- is created)
  • Configure the menu to add required items in menu and provide the ID, Caption to the menu items.
  • Right click on Dialog and open Properties...
  • From Menu Combobox, select the ID of the required menu ( here IDR_MENU1)
aJ
A: 

See DLGCBR32 MFC sample in the MSDN.

Shino C G
+1  A: 

You can add a menu resource to a dialog application, but you haven't said which version of Visual Studio you're using so details are hard to provide. You should know that because CDialog isn't derived from CFrameWnd, update routing won't work - you need to read this article for the details.

That article includes instruction for adding the menu if you're using a version of Visual Studio post-VC6, which you probably are - read the "more information" section further down the article for that.

Bob Moore