resource ID and NAME

Started by
4 comments, last by Dave Hunt 18 years, 1 month ago
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?
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
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?
If the ID isn't defined in resource.h, then your resource won't compile.
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");

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.

This topic is closed to new replies.

Advertisement