(HBITMAP)LoadImage(hInstance, MAKEINTRESOURCE(IDB_BG), IMAGE_BITMAP, x, y, NULL);
This piece of code does not seem to work as it should...
I need to draw a bitmap which is saved as source but the LoadImage() does not want to allow me that...
The only thing what works for me is
(HBITMAP)LoadImage(hInstance, TEXT("*.bmp"), IMAGE_BITMAP, x, y, LR_LOADFROMFILE);
But that is not what I am for...
What shall I try else?
If you are loading from a resource you need to use the function that operates on those. If you are loading an image from an external source then you need to use LoadImage as you have shown.
I will try to look it up... If you have in mind some particular function that does this please note me...
Originally Posted by Bubba
LoadResource / FindResource I think.
LoadImage is fine for loading resource bitmaps provided you have properly included a BITMAP resource definition statement (in a resource script, *.rc) and associated #define for IDB_BG in your build - but replace NULL with LR_CREATEDIBSECTION as the last parameter of LoadImage. Make sure you check that the return value from LoadImage is non-NULL; if it's NULL, use GetLastError to provide you with more information regarding the api function failure.
Originally Posted by Gordon
Search this board, too, as this sort of thing has been discussed before.