Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dialog-based application

Posted on 1998-08-14
10
Medium Priority
?
245 Views
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
0
Comment
Question by:pagz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 2

Expert Comment

by:kinkajou
ID: 1320828
Inside Visual C++ is a great book for learning MSVC++ 5.0 and MFC.
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1320829
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 ;-)
0
 
LVL 2

Expert Comment

by:kinkajou
ID: 1320830
That would be MS Press and Kruglinski...
0
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!

 
LVL 6

Expert Comment

by:thresher_shark
ID: 1320831
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.
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 200 total points
ID: 1320832
Uh, no.  The reason that CMenu doesn't show up in the list of classes offered by ClassWizard is that you almost never need to derive your own class from CMenu--you'd only want to derive your own class if you were doing owner-draw menus. (If you look at the CMenu declaration or the documentation, you'll notice it only has two virtual functions, and both of them have to do with owner-draw.)

If you want to use a menu, just instantiate a CMenu.  Then, use the LoadMenu() member to load the resource.  Then, call SetMenu() on the dialog object to set the CMenu.

It's really easy. It's not even five lines of code, so why bother with a Wizard?

B ekiM

0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1320833
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.
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1320834
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


0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1320835
>> 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.
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1320836
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
0
 

Author Comment

by:pagz
ID: 1320837
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
Joe
0

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

670 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