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

The world is against me!!! LoadImage() question!

This topic is 5335 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

OK, direct draw won''t let me create a surface, despite everything being seemingly correct so I decide to just leave that for now to concentrate on actually making a game instead of struggling with an API (yes I know GDI is an API), So I rewrite my functions to use GDI instead of DX and then GDI decides it hates me too. I have this line of code: if (!(hbmpNew = (HBITMAP)LoadImage(NULL, lpszFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE))) Which was working perfectly, even when direct draw wasn''t. I tried GetLastError() and it says "The operation completed successfully" so apparently it''s working fine but after the function call hbmpNew is still NULL. Can someone PLEASE help me befor I join a hippy commune and never see a computer again? And to make things worse I just posted this in the wrong forum a minute ago, hows that for bad karma!

Share this post

Link to post
Share on other sites
OK, I''m not sure if it would hel anpy though. The entire code in the function up until LoadImage():


LOG log; //my error log class

HBITMAP hbmpNew = NULL; //used for LoadImage()

HBITMAP hbmpOld = NULL; //used for SelectObject()

LPVOID msgBuffer1 = NULL; //used fo Format message troubleshooting

//load load the bitmap

if (!(hbmpNew = (HBITMAP)LoadImage(NULL, lpszFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)))
log.string1 = "couldn''t load Image";
log.ErrorLog("GDI load bitmap.txt");
}//end if

Share this post

Link to post
Share on other sites