Dialog based MFC menu

Posted on 2007-10-12
Medium Priority
Last Modified: 2013-11-20
I have a form I am trying to add a menu to. I have created a menu by adding a resource and manually typing in the cascading menu options. I have added the menu id to the main form's properties but now I am at lost on how to code the  individual menu options. The first one is the file menu how do I code the options for open file and save as and the like for example on open file I want the system dialog to open.
Question by:sassy4sure
  • 3
  • 2
LVL 12

Accepted Solution

OnegaZhang earned 500 total points
ID: 20070241
You can add menu to dialog via resource editor or by code.
To use resource editor associating menu with dialog, follow this article: http://support.microsoft.com/kb/100770
How to use accelerator keys and a main menu on the dialog box in Visual C++

To add menu by code:
add CMenu m_menu; as a member variable of the COnegaDlg class.

To add message handler, you can either do it by IDE or by hand.
add afx_msg void OnMenu1(); to COnegaDlg class.
Implement it in cpp.
add it to message map
LVL 45

Expert Comment

ID: 20070414
I'd consider a major change - base your app on a SDI / Form view.
This will give you a lot of support for menu that a dialog based app doesn't.

Author Comment

ID: 20071962
>>I'd consider a major change - base your app on a SDI / Form view.
This will give you a lot of support for menu that a dialog based app doesn't.

Whats the difference between SDI and dialog based?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 20072052
Ok I think I will go with the SDI Form but I still don't know how or where to code the menu options and is there a way to get rid of the  tool bar beneath the menu .
LVL 45

Expert Comment

ID: 20073060
toolbar - when you create a new project just deselect the option for a toolbar.

Menu options - resource editor, select the menu option, right click - choose add event handler.
LVL 45

Expert Comment

ID: 20073862
ps.  Don't forget for future if more than one expert assists then you can split points between the experts.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question