Archived

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

Machaira

Loading Bitmap Problem

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites