This topic is now archived and is closed to further replies.


how to include bmp's

Recommended Posts

Hello 31337noob,

Usually this can be accomplished using a resource script with MSVC. Then you can add .bmp, .tga, .txt files and the alike. If you are using MSVC please let me know I'll then explain how to add them.

If you are using any other compilers I'm not sure if they all have resource scripts or whatever.

- [BDS]StackOverflow

[edited by - BlueDev on March 18, 2004 1:41:26 PM]

Share this post

Link to post
Share on other sites
Alright then,

Now if you already have an existing project here is what you'd do:

File -> New

(Under the "Files" tab) -> Resource Script (not Resource Template)

Of course give it a name like "resource" under the "File name:" edit box area.

Then go to your resource tab area and double click the closed tree folder called *"resource" resources.
*being whatever you called your resource script

Once you do that, a sub tree should appear under it stating "No Resources". That means you are looking at the right area.

Right mouse click on the main parent tree called *"resource" resources and click "Insert..." Under the dialog click "Import..."

Change the "Files of type:" from "Icons(.ico)" to "All Files(*.*)"

Find the fields you want and add them. First bitmap should be called IDB_BITMAP1 so lets go off of that for now.

In your source code, most likely your main file put:

#include "resource.h"

To make sure everything is included from your resource. Now that that is cleared up I will show an example of how to load the bitmap or whatever:

#include <windows.h>
#include "resource.h"

HICON hIcon;
HINSTANCE hInstance;

// Bitmap

hbm = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) );

// Icon


It's not the full code just an example. Also be sure to use MAKEINTRESOURCE when loading stuff from the resource. No worries the files will be compiled into your .exe file so no more image files being accessed by people!

Also, you can create Dialog boxes from the resource script, its really cool. I have a tutorial on my site that teaches how to do that in case you want to check it out. (Win32 tutorial #5)

Hope this helps!
- [BDS]StackOverflow

BlueDev Studios

[edited by - BlueDev on March 18, 2004 9:44:02 PM]