Skip to main content
gamedev.net
🔒 Locked

LoadImage bitmap question

Started by ursus Jan 12, 2005 at 3:19 AM 1 replies 900+ views
Original Post
ursus
ursus
hello all under win32 this is how you normally load a bitmap: pinky = (HBITMAP)LoadImage(hinstance,"pinkidonkey.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE); the condition is that the bitmap has to be in the same folder that the exe file. now, i was wandering if it's possible to create another folder, like: c:\...\YourApp\graphics put all the files in that folder and force the c sourcecode to look for the image files in that directory? thanks peter
Endurion
Endurion
Of course, you just need to put the complete path into the LoadImage function.

pinky = (HBITMAP)LoadImage(hinstance,"c:\\yourapp\\images\\pinkidonkey.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

If you insert the path directly like that make sure it has two backslashes though.

Even better, get the path from your exe and build a complete path from that. This way you ensure that the image is ALWAYS taken from the path you want.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
ursus
ursus
thank's

what i did was:

c:\blah\blah...

and this is probably why it didn't work. needed: \
anyways, thank's again

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.