• Advertisement

Archived

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

Resources in Windows

This topic is 6550 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
Advertisement

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.

e.g.

HANDLE image = LoadImage(...);

SelectObject(hdc, image);


HTH,

-mordell

Share this post


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

HBITMAP = LoadImage(hInst, MAKEINTRESOURCE(IDB_BITMAP1));

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

Share this post


Link to post
Share on other sites

  • Advertisement