Archived

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

breakscience

image loading problem

Recommended Posts

// load the BMP file m_hBitmap = (HBITMAP)LoadImage(NULL, MAKEINTRESOURCE(ResID),IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); Why doesn''t this work? ResID is an integer passed to a member function of my GDI Bitmap class. This seems like it should work, but I get an invalid param error code during runtime. I would appreciate any help, as I posted something similar before with no response. Thank you. Break;

Share this post


Link to post
Share on other sites
When you load a resource, you need to to specify where to get it from. In this case, the HINSTANCE parameter is set to NULL. The function doesn''t know where to look to find the image. Instead, try setting the HINSTANCE to you''r applications instance, i.e.:
hBitmap = LoadImage(g_hInst, MAKEINTR...etc
That should work.

Share this post


Link to post
Share on other sites