modifying resource.h and rc files

N

NoSpin

I downloaded some sample code off of the internet and I am attempting
to add certain features. I am a little confused about how .rc files
work, they have always been autogenerated for me. Here is the code I
have:

m_Control.CreateOffScreenSurface("ChessBoard",IDB_IMAGE);

IDB_IMAGE appears to look up the file name of a picture that the
program is to use. I would like to add a reference to another picture
so that I can display two pictures. The confusing part is IDB_IMAGE
appears to be defined in two places.

The function call is asking for a UINT (where IDB_IMAGE is passed).
IDB_IMAGE is defined as a some form of a constant string as well as a
const UINT. So somehow CreateOffScreenSurface is taking the UINT
version of IDB_IMAGE and looking up the string version. Here is the
two places it is defined:

this is in a .rc file
IDB_IMAGE BITMAP DISCARDABLE "res\\dino600x800.bmp"

and this is all of resource.h

//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by DirectX.rc
//
#define IDD_ABOUTBOX 100
#define ID_START 102
#define IDR_MAINFRAME 128
#define IDR_DIRECTTYPE 129
#define IDB_IMAGE 130

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif

What do I need to do to create another variable that points to a
different file? I tried defining a different variable in resource.h
and the rc file, but that didn't work, plus I didn't know what number
to put in the UNIT version.

Can someone help me understand what is going on in these two files?

Thanks,
Brett
 
R

red floyd

NoSpin said:
I downloaded some sample code off of the internet and I am attempting
to add certain features. I am a little confused about how .rc files
work, they have always been autogenerated for me. Here is the code I
have:

m_Control.CreateOffScreenSurface("ChessBoard",IDB_IMAGE);

IDB_IMAGE appears to look up the file name of a picture that the
program is to use. I would like to add a reference to another picture
so that I can display two pictures. The confusing part is IDB_IMAGE
appears to be defined in two places.

The function call is asking for a UINT (where IDB_IMAGE is passed).
IDB_IMAGE is defined as a some form of a constant string as well as a
const UINT. So somehow CreateOffScreenSurface is taking the UINT
version of IDB_IMAGE and looking up the string version. Here is the
two places it is defined:

this is in a .rc file
IDB_IMAGE BITMAP DISCARDABLE "res\\dino600x800.bmp"
[redacted]

What do I need to do to create another variable that points to a
different file? I tried defining a different variable in resource.h
and the rc file, but that didn't work, plus I didn't know what number
to put in the UNIT version.

Can someone help me understand what is going on in these two files?

Yes, someone can help you, but not in this group. You are asking about
either the Windows API, or Visual Studio specific stuff. Try a newsgroup
with either microsoft or windows in its name.
 
N

NoSpin

No need I found the solution.

#define IDB_IMAGE 130
#define IDB_PIMAGE 132


IDB_IMAGE BITMAP DISCARDABLE "res\
\dino600x800.bmp"
IDB_PIMAGE BITMAP DISCARDABLE "res\
\other.bmp"

for some reason I need to skip a number and define the next variable
as 132 instead of 131. Very wired stuff. I figured I would post in
case anyone has similar problems.


Thanks
Brett
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,504
Latest member
SherryFerr

Latest Threads

Top