Jump to content

[SOLVED] General C++ Questions (win32 API)


Recommended Posts

I have been practicing doing C++ Console (Command Line) applications for quite awhile. When I got my hands around the basics, I started dealing in the Win32 API.  I have been using the:

http://winprog.org/tutorial/menus.html

I have some questions about these tutorials.

 

First off on the resource file he uses stuff like:

#define IDR_MYMENU 101
#define IDI_MYICON 201

#define ID_FILE_EXIT 9001
#define ID_STUFF_GO 9002

What I was wondering is....he mentioned that it was ID_whatever

If I changed the word "ID" to something else would it work?  Is that what it's

suppose to be, or is that simply showing that you can use any word for the id?

Also what are the numbers beside it? I don't get it.  Those numbers listed beside each one.

Link to comment
Share on other sites

Also, are you able to name the .rc file anything you want.  Like what is better. Creating a resource file for everything, or creating a resource file for different things? My thoughts would be creating one .rc file for everything I need (dialogs, menus (however many), icons, anything else).  Or should I create a different rc file

for each item...

like menu_one.rc, icon_one.rc, dialog_one.rc.  I was thinking it would be a lot cleaner to have 1 .rc file for everything.

 

I might have more questions but I will keep them all here in this one post, as to not cause clutter in the forums.

Link to comment
Share on other sites

Do you know what the preprocessor is? The lines starting with hash marks are what's called preprocessor directives. The preprocessor is run before the compiler. The #define directive defines a constant, so when the preprocessor runs it will, in this case, go through the source code and everywhere it finds IDR_MYMENU it will replace it with 101. Then the compiler will run.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.