Sign in to follow this  
Progames25

Include Bitmap

Recommended Posts

Hello, first of all if this is not in the correct forum please let me know, I just did not see anywhere else that this question would apply to. Ok so, So far when drawing bitmaps to the screen/my window, in order to ID the bitmap as a resource in my Visual C++ 2008 project (native) I have been using the following line of code in a .rc file(the ... is just there in this example to make the path shorter, but not there in the real code in my project):
IDB_Main_Background BITMAP "C:\\Visual Studio 2008\\.........\\image\\BMPBackground.bmp" 


And in a header file I ID that as: #define IDB_Main_Background 200 Ok so, this works and all but I don't want the files to be accessed trough a file path. I want these files to be included in my exe, compiled into my exe and read from the exe at run time. I don't want to have to include the files with the exe where everyone can touch them. When I try to add the bitmaps as a resource in my project the compiler does not notice them unless they are 4bit bitmaps, and these are 24bit-32bit... When I have them set as a 24bit bitmap resource I use that same line of code but it looks more like this: IDB_Main_Background BITMAP "BMPBackground.bmp" But when I compile my program, I get an error that it cant find "BMPBackground.bmp". So unless I am doing that last part wrong, how can I do this? Thanks, Progames25 [Edited by - Progames25 on March 16, 2009 8:05:24 PM]

Share this post


Link to post
Share on other sites
What do you mean "the compiler does not notice them"? Does it give you an error that it does not exist? Does Visual Studio not display them in the resources list? Did it give you an error when adding it? Is it in the resources list but you cannot edit it within Visual Studio?

If Visual Studio cannot edit them, that's ok. It's not meant to be an image editor and there will be some file types that it cannot edit but as long as they are listed as being in the resource file they will still be included in the exe. This includes 32-bit bitmaps.

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