D3DXGetImageInfoFromFile not working returning 0x88760b59

Started by
2 comments, last by Evil Steve 15 years, 5 months ago
Hi, Im just learning Direct3D9 from a book and ive got to the part of learning about surfaces. Anyhow in order to create a surface with the dimentions of the image im trying to load, I am going to use the function D3DGetImageInfoFromFile and thats where im currently stuck. Heres the method thats apart of my classes.

HRESULT Direct3D9Surface::CreateSurfaceFromFile(IDirect3DDevice9 *pDevice,LPCSTR szFile)
{
	HRESULT r;
	D3DXIMAGE_INFO ImageInfo;

	// set all properties to 0
	ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO));

	// this is where my application fails and returns 0x88760b59
	if(FAILED(r = D3DXGetImageInfoFromFile(szFile,&ImageInfo))){ return r; }

        // ...
}


And im calling it like...

if(FAILED(dxResult = pSurface->CreateSurfaceFromFile(pDevice->GetInterface(),TEXT("bg01.bmp"))))


Advertisement
That error code is D3DXERR_INVALIDDATA. The Debug Runtimes and linking with d3dx9d.lib should tell you what the problem is - It sounds like the file isn't a valid BMP.
Thanks for your quick reply.

I dont seem to have a control panel applet to switch debugging levels. I have been looking for directx.cpl but its not on my system. I am using DirectX 9.0b SDK and DirectX 9.0c for runtime. Does that make a difference for development?

I would download newer SDK but I am one of those unfortunate people who still have dial up.

As for the picture being not valid, I created it in Paint Shop Pro and have checked it out in MSPaint and mfctex that comes with the SDK and alls fine.

Any ideas how I would change debugging levels without the directx applet?

I have tried debugging with d3dx9d.lib but it asks for d3dx9d.dll and I cant find that either..?
Quote:Original post by xmp
I dont seem to have a control panel applet to switch debugging levels. I have been looking for directx.cpl but its not on my system. I am using DirectX 9.0b SDK and DirectX 9.0c for runtime. Does that make a difference for development?
Yeah - you need to have the same SDK version as runtime version for the debug runtimes to work, otherwise you'd be "downgrading" to the debug runtime which Windows doesn't let you do.

Quote:Original post by xmp
Any ideas how I would change debugging levels without the directx applet?

I have tried debugging with d3dx9d.lib but it asks for d3dx9d.dll and I cant find that either..?
You'd need to use the debug runtimes for the debug output to change at all, so it isn't relevant. I'm not sure, but the DX9.0b SDK may not have a debug version of the D3DX DLL. I'd strongly recommend trying to get a copy of the latest SDK (And Visual Studio 2008 if you're using a compiler <= VC6), either by getting a friend to download it, downloading it from an Internet café, or ordering it from Microsoft (I don't know if they still do that, or where on the site you'd do that though).

Looking at your code, the only other thing I can see that might be slightly suspect is you're passing a LPCSTR (const char*), but calling D3DXGetImageInfoFromFile() which takes a TCHAR* (Which is a char* usually, but can be a wchar_t* in unicode builds). I'd recommend changing the function to take a LPCTSTR instead, even if it's just so your code will compile in Unicode mode.

You could also try loading the file into memory and using D3DXGetImageInfoFromFileInMemory() instead, just to remove the file loading process from the equation.

This topic is closed to new replies.

Advertisement