Sign in to follow this  
derek7

resource ID and NAME

Recommended Posts

derek7    100
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
Evil Steve    2017
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
derek7    100
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
derek7    100
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
Dave Hunt    4872
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this