|
proper way to call this function
i just want to know if im calling this function properly
For the most part, your function is ok but there's one huge problem that'll make your compiler scream.
Decide whether you want to pass the filename for the bitmap or if you want to pass an HBITMAP structure. They are very different things! One is a string, the other is a structure full of exciting junk. For the bitmap, keep the function declaration as is, otherwise, change it to say "char *szFileName" instead of "HBITMAP hbitmap".
You can include code to load the bitmap into the HBITMAP structure but I'm not sure what it is other than that you use the LoadImage () function. Look it up.
Otherwise, I think it's fine except for a few places where addresses might need to be passed instead of values.
-Goku
SANE Productions Homepage
Edited by - Goku705 on February 23, 2001 9:04:59 PM
Decide whether you want to pass the filename for the bitmap or if you want to pass an HBITMAP structure. They are very different things! One is a string, the other is a structure full of exciting junk. For the bitmap, keep the function declaration as is, otherwise, change it to say "char *szFileName" instead of "HBITMAP hbitmap".
You can include code to load the bitmap into the HBITMAP structure but I'm not sure what it is other than that you use the LoadImage () function. Look it up.
Otherwise, I think it's fine except for a few places where addresses might need to be passed instead of values.
-Goku
SANE Productions Homepage
Edited by - Goku705 on February 23, 2001 9:04:59 PM
ok well i also had another question about a loading bitmap function, everytime i run my program and try to load the bitmap the program just quits upon execution, if i dont try and load the bitmap it works just fine.
|
Have you got the image files in the right directory. Sometimes that might not be the one where the exe file is,for example if you are debugging via compiler.
God saw all that he had made. Shit happens sometimes. --the sixth day.
there in the same directory as my project but im not sure if my function is set up right to load a file or resource
im calling it like this
loadbitmap("tiles.bmp",0,0,image);
im calling it like this
loadbitmap("tiles.bmp",0,0,image);
I think that in the call to LoadImage (), "main_instance" should be replaced with NULL if you want to load from file (as well as the LR_LOADFROMFILE that you''ve got). That may be it, it may not.
Failing that, everywhere you''ve got a "return (FALSE);", stick in a MessageBox () statement. Something like:
MessageBox (hwnd, "LoadImage () failed.", "Error!", MB_OK);
Put one in for each error check with appropriate messages and you''ll find out exactly what''s wrong (down to which function''s failing at least). Better yet would be to handle all of the possible error returns for each but that would be too tedious to set up.
-Goku
SANE Productions Homepage
Failing that, everywhere you''ve got a "return (FALSE);", stick in a MessageBox () statement. Something like:
MessageBox (hwnd, "LoadImage () failed.", "Error!", MB_OK);
Put one in for each error check with appropriate messages and you''ll find out exactly what''s wrong (down to which function''s failing at least). Better yet would be to handle all of the possible error returns for each but that would be too tedious to set up.
-Goku
SANE Productions Homepage
February 25, 2001 02:06 PM
well changing the main_instance to null didnt work but is this the way i add the message boxes in the function?
if so it didnt work
if so it didnt work
|
well i ditched that function above to the one in ddutil.h and was wondering does anyone here make there own bitmap loading functions or use the one in the ddutil file?
First I used my own bitmap loading function (well, parts of it was written by GA) but then I realised that I needed Jpeg support so I got FreeImage. It works great and it''s free. the guy who programs it just wants to be in the credits if you use the programm comercially... real great tool and it allows me to concentrate on other things than writing a complicated jpeg loader so that the designers are satisfied..
cya,
Phil
Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states![](wink.gif)
![](http://www.crosswinds.net/~druidgames/resist.jpg)
RAW!
cya,
Phil
Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states
![](wink.gif)
![](http://www.crosswinds.net/~druidgames/resist.jpg)
RAW!
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement