Advertisement

Newbie C++ difficulty

Started by April 12, 2002 08:12 AM
3 comments, last by maccaroo 22 years, 7 months ago
I''m trying to add a resource file (.rc) to my project in MSVC++6, but it doesn''t seem to be doing what I''m asking it to do (sorry, I mean, what I''m WANTING it to do). I''m going through a section in a Win32 tut on menus and icons, and I''m trying to add a resource for a menu. I don''t understand what happens when I go to File -> New -> Resource Script. I get a new file in the project window under ''Source Files'', and the ''Resource Files'' folder stays empty. Also, it creates a header file called ''resource.h'' (which is mentioned in the notes) but I''m not sure why. After all this, the new resource file that is created has a picture of a folder in it, but it seems that the development needs to be done graphically from here on, whereas the tut continues in text (which is what I wanna do). Please help me and tell me what I''m doing wrong. I know this is a very silly problem.
OK, well I''ll just sort of rant...

There shouldnt even be a "resource files" under "Header Files" and "Source Files". You could add one if you like, i suppose...the resource file will appear under "Source Files". A new tab on the sidebar will appear labeled "Resources" or something similar. Realize that a resource script is an ASCII file that has its own special syntax. You can edit it directly, but MSVC allows you to make graphical adjustments. The header contains definitions for all the different resources that you will need to pass to any of several(hundred) Windows API functions and macros to access those things.

Lastly, don''t call any problem silly. Don''t debase or insult yourself ever; that''s our job as we see fit.

____________________________________________________________
Direct3D vs. OpenGL
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Advertisement
Thanks for the reply. I have sample code that was supplied with the tut, and I have the completed example. Still, I can''t seem to get myself to that point (it should be easy).

One thing that is in the tut (comleted code) is the following:

#include "resource.h"

IDR_MYMENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_FILE_EXIT
END

POPUP "&Stuff"
BEGIN
MENUITEM "&Go", ID_STUFF_GO
MENUITEM "G&o somewhere else", 0, GRAYED
END
END

IDI_MYICON ICON "menu_one.ico"

I seems to make sense and whatever, but I can''t find it in the completed code, and the menu can only be edited graphically. Did the person who created the tut do it graphically, or did he do it from text. (There are advantages to both I''m sure).

PS: How do I create a code window in my postings?
quote: Original post by maccaroo
Did the person who created the tut do it graphically, or did he do it from text. (There are advantages to both I''m sure).

Do it graphically and then hand-tweak the text if necessary. Forget about what others do; do what makes sense for you.

quote:
PS: How do I create a code window in my postings?

Read the FAQ.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! | Asking Smart Questions ]
Thanks to Kylotan for the idea!
The reason why I want to do things the tutor''s way, is that I wanna be able to follow his code all the way through, and hopefully make my own adjustments.

I''m very new to the Win32 API and even WinMain took a little while to figure out. I used to own a "Teach Yourself Visual C++ in 21 Days" book, but I only read a few chapters, becuase I wanted to learn the source code behind all the silly things like menus, and not the graphical method (at least not yet). This tut looks like it does it with code, but I can''t figure out how or where.

Also, another funny thing is the resource.h file. The tut mentions it, and even edits it, but it does not appear in the project window. Even after I compile the project (which should include all the files that are needed, as far as I know) it remains separate. It just sits in the same folder as the main .exe file... why?

Thanks again for any help

This topic is closed to new replies.

Advertisement