Jump to content
  • Advertisement


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


how to include bmp's

This topic is 5267 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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]

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!