Jump to content
  • Advertisement
Sign in to follow this  
derek7

resource ID and NAME

This topic is 4513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

in .rc file resource ID and NAME seem to be no different. look ///////////////////////////////////////////////////////////////////////////// // // Bitmap // IDB_BITMAP1 BITMAP "tilE1.bmp" BITMAPS2 BITMAP "bitmap2.bmp" BITMAPS2 is seem to be ID(integer) or NAME(string) , rc file can not tell which it is. how to know what is BITMAPS2? ID or NAME?

Share this post


Link to post
Share on other sites
Advertisement
The ID is defined in resource.h, it's a preprocessor define, so you can refer to things as IDB_BITMAP1 instead of having to use an integer like 103.
IDB_BITMAP1 BITMAP "tilE1.bmp"
is:
ID Type Filename

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
The ID is defined in resource.h, it's a preprocessor define, so you can refer to things as IDB_BITMAP1 instead of having to use an integer like 103.
IDB_BITMAP1 BITMAP "tilE1.bmp"
is:
ID Type Filename


so if the ID not defined in resource.h file, the "ID" will be treated as NAME?

Share this post


Link to post
Share on other sites
I mean if ID is not define in .h file.
it could be treated by string name. for example

/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//

IDB_BITMAP1 BITMAP "tilE1.bmp"
BITMAPS2 BITMAP "bitmap2.bmp"

I mean this
LoadBitmap(0,"IDB_BITMAP1");

Share this post


Link to post
Share on other sites
Quote:
Original post by derek7
I mean if ID is not define in .h file.
it could be treated by string name. for example

/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//

IDB_BITMAP1 BITMAP "tilE1.bmp"
BITMAPS2 BITMAP "bitmap2.bmp"

I mean this
LoadBitmap(0,"IDB_BITMAP1");


That is correct. The resource compiler stores the ID as a string. If you specify a numeric value in the resource file, it is converted to a string where the first 16-bits are the binary representation of the ID and the second 16-bits are zeros. That's why you use MAKEINTRESOURCE() when using integer IDs for resource names.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!