The world is against me!!! LoadImage() question!
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!
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
From a quick glance over your code it appears everything is correct. Are you sure you are passing the correct filename to the LoadImage? That could be your problem to.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement