We help IT Professionals succeed at work.

Dialog-based application

pagz asked
Medium Priority
Last Modified: 2013-11-20
Which base class can I use after creating a menu resource  in a dialog-based appplication?

When I create a dialog based application and add a menu resource to it, I get the "add class" dialog.  But I don't
see CMenu as a choice.  Which class can I use for this menu resource?  I am using VC++ 5.0.  (I'm just a rookie...but
I must learn MFC!!)

Any good books you can recommend??
Let me know...

Please help....
Thanks, Joe

PS --  Please send to this address also:

Joseph Pagliarulo/Mount Pleasant/Contr/IBM@IBMUS
Watch Question

Inside Visual C++ is a great book for learning MSVC++ 5.0 and MFC.
From my experience not all versions of VC++ come with that book, mine didn't, but I have the "Enterprise Edition" so I don't know if they just think I know everything ;-)

That would be MS Press and Kruglinski...
Also, for the problem, you do derive the menu from CMenu even though that's not an option.  Seems to me that Class wizard has a few problems.  If you just want to make the menu show up in your dialog box, select "Select an existing class" and choose your dialog box class.
Unlock this solution and get a sample of our free trial.
(No credit card required)
I meant that he could derive a class from CMenu, but ClassWizard would not allow it.

If you don't want to write any code, simply select "Select an existing class" then select the name of your dialog box class.  Then, when you start the program, the menu will show up in the dialog box just like any other menu you've seen.

Uh, look: you're still all wet, Thresher_Shark. You don't need to derive from CMenu unless you're doing owner-draw. This question has nothing to do with owner-draw menus, so deriving from CMenu is trivial.

If you don't want to write any code, simply use the "Menu" setting in the properties of the dialog itself to get the menu resource directly associated with the dialog resource. Your "don't want to write any code" advice is the long way around.

B ekiM

>> If you just want to make the menu show up in your dialog box,
>> select "Select an existing class" and choose your dialog box
>> class.

Even if it is the long way around, what's wrong with it?  I know that when you derive from CMenu, you are most likely creating a new kind of menu, unless you just want to derive from it so you can use your own class name but that would be stupid and pointless.

There are simply several solutions to this problem, I suggested one, and you suggested one.

What's wrong with it is that it's the long way around: it's inefficeint and overly tedious.

Associating a menu with a class just tells ClassWizard that the menu choices in the menu should be available as commands in the class you choose, or in the class you newly create. It won't cause the menu to be displayed when an instance of that class creates a window.

If you want to instantiate and manipulate the menu, you'll want a CMenu, as I suggest.  If you don't need manipulation, you'll want to set the resource as I suggest.

B ekiM


I think Mike's a pro. Very brief and to the point with the problem.  I'm really fascinated with VC++ but I still find myself at a standstill most of the time.  I really want to learn it.

Thanks Mike
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.