Loading Bitmap Problem

Started by
7 comments, last by Machaira 24 years, 3 months ago
Give us some code.......how are we supposed to know what you have done??

Did you actually use the same files as the examples does???? Right filename????

Also keep in mind that the executable starts up in a separated directory....if you start up the executable from that directory, the image should be in that directory, otherwise it should exist one directory down.

------------------
Dance with me......

http://members.xoom.com/CJdeVos/index.htm

Advertisement
It's not brain surgery but here it is:

code:
LPDIRECTDRAW7 lpDirDraw;LPDIRECTDRAWSURFACE7 lpStartScreen;char szBitmap[] = "intro";lpStartScreen = DDLoadBitmap(lpDirDraw, szBitmap, 0, 0);

The two pointers are members of a wrapper class, the bitmap string and DDLoadBitmap function call are in a class function that is called from the WinMain. I've copied the bitmap into the debug directory (it already existed in the code directory), run the code from within the IDE and directly from the exe file.

Thanks

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

How about using "intro.bmp"???

------------------
Dance with me......

http://members.xoom.com/CJdeVos/index.htm

Do you have the right filename in your .rc file?


Mandesean

The example app does not use the extension so should not be needed. I'll give it a try anyhow. The name in the resource file is correct, but even if it wasn't the DDLoadBitmap function tries to load it as a file if it can't load it as a resource. I'm stumped. Thanks for the suggestions.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

OK, for some reason using the extension corrected the problem, even though Microsoft's sample doesn't use the extension and theirs works! WTF?!?!

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

This is just a stab in the dark (I've never bothered to look at the examples from MS, and its been a while since I used DDLoadBitmap). I know that DDLoadBitmap can load both reasources and files. It could be that in there example MS used the resources name, thus no extension. However, in you efforts you may have loaded the bmp into your program as a resource but you left the name as the resources as the default. This would most likely be something like IDB_BITMAP1. This means that when you tried to use the filename with no extension it would not work, because the filename with no extension is not the name of the resource. When you added the extension to the string, DDLoadBitmap started using the actual file and not the resource bitmap.

I could be wrong. I'm just guessing here.

For some reason I just can't get the DDLoadImage function to work. I've loaded it as a resource and it also exists in the code directory. It still returns an error saying it cannot find the file after trying the LoadImage functions. WTF? It's exactly like the DDex4 example. Am I missing something?

The weird thing is that it used to work in windowed mode but not in fullscreen mode. I haven't changed anything but now it refuses to work in either mode!

Any help would be apprectiated.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

If you are loading it from a file that has an extension, the string passed to the function needs the extension. If it is a resource, use the resource name.

------------------
- mallen22@concentric.net
- http://members.tripod.com/mxf_entertainment/

This topic is closed to new replies.

Advertisement