Solved

Using resource editor in MS VC++ 4.0

Posted on 1998-05-05
4
248 Views
Last Modified: 2013-12-03
I have a very simple program (from Schildt's "Windows 95 Programming") which has a single menu with just a couple options.  It works fine from VC++ V4.0 IFF I hand edit the resource script from scratch.  I want to use the provided resource editor.  When I try it, it creates the menu in a .rc file, it provides a resource.h file (which I include) and when I BUILD ALL, it appears to be compiling the resource script.  But, when I run the program, there simply is no menu at all.  I have not made any changes to the .c file which worked just fine with the hand-editted resource script, and have made sure that all of my identifiers are the same.  But It just does not link in the resource file.  What am I doing wrong?
0
Comment
Question by:kmullin
  • 3
4 Comments
 

Accepted Solution

by:
waimun earned 50 total points
ID: 1399325
Have you include the resource.h file in your .c file?
#include "resource.h"
...
try the above
0
 

Author Comment

by:kmullin
ID: 1399326
I found my answer through other means.  The answer was this:
Schildt's book had me code:
     wcl.szlpMenuName = "MyMenu";
which worked fine.  But, when the resource editor creates it, it modifies (something?) that doesn't want a character string as the menu name value (as above.)  It wants an integer value that specifically identifes the menu.  The resource editor provides this in the resource.h file in the form of a #define, as in
     #define MYMENU 101
So, I had to change the code (remove the quotations) with
     wc.szlpMenuName = MYMENU;
and it works fine.  THAT's the piece I was missing.

To be fair to waimum, he didn't have enough to work with.
0
 

Author Comment

by:kmullin
ID: 1399327
I have a follow up question.

Using the solution found above, I get numerous warnings from the compile.  This is really hokey!  Does anyone know if there is another way?
0
 

Author Comment

by:kmullin
ID: 5718367
I found the answer to this question as well.  In my solution, I said I coded
     wc.szlpMenuName = MYMENU;
But what I had to do, to prevent the warnings, was code it using a Windows provided macro, as in:
    wc.szlpMenuName = MAKEINTRESOURCE(MYMENU);
and THAT suppressed the warnings.

I'm going to delete the question, because I found the answer.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

831 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