• ### Popular Now

• 13
• 18
• 19
• 27
• 10

#### Archived

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

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

This topic is 5429 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
Could you post a bit more of the code prior to this statement?

##### 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