Jump to content
  • Advertisement


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

Roger Hill

Resources in Windows

This topic is 6795 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, I''m having a devil of a time using resources in Windows. I build a win32 app that registers a normal window, draws it, and goes into the famous message loop. I can have it read ''resources'' such as .bmps and such from the same directory just fine, but when I include the .bmps in the project (vc++5.0), I can''t get windows to ''find'' the embedded/included .bmp. I''ve made sure to include the Script.rc, the resource.h, and the .bmp file in the project. I''ve checked to make sure that the .bmp has a ''macro'', IDB_BITMAP1, and the resource.h file has been #included in the main.cpp file. I''ve been using LoadImmage(), LoadIcon(), LoadCursor(), etc, and none of them seem to work. The project will compile w/o errors, but only default resources will be displayed.(That is, the standard cursor, the lowest nmbered icon will be displayed as the application icon, etc.) Any suggestions? I''m out of ideas, and I can''t find any useful examples in the VC++5.0 help files... Thanks in advance.

Share this post

Link to post
Share on other sites

It could be that the params to the LoadXXX are incorrect.

Or, it could be that you aren''t selecting the GDI object into a valid device context after you have loaded it.


HANDLE image = LoadImage(...);

SelectObject(hdc, image);



Share this post

Link to post
Share on other sites
You should load the resources like this


Where hInst is the Instance variable that you receive in WinMain().

Share this post

Link to post
Share on other sites

  • 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!