Win32 Application Error

Loopback elliott.darfink at gmail.com
Tue Jun 28 19:51:12 PDT 2011


Thank you for your reply!

I do not use multi-threading so it is not related to that. Though I do
have located the error. It seems as if the application only hangs/delays
application exit, when I load a texture file with DirectX. To be
specific, the function in this case is D3DXCreateTextureFromFileExW.

I still do not see though why the terminate function call fails. Since
the same code works on my other computer. I've also used DirectX debug,
and checking all HRESULTs (success or failure basically). The DirectX
debug output does not display any errors nor warnings and all HRESULTs
returns successfully. The texture loaded with the function does also
work flawlessly, likewise the free memory functions for the textures.

Below is the code that I use for loading and releasing textures:

class (...)

IDirect3DTexture9 LoadTexture(IDirect3DDevice9 device, string fileName, 
D3DXIMAGE_INFO * info = NULL)
{
	// Check if the texture has already been allocated
	IDirect3DTexture9 * pTexture = (fileName in m_textures);
		
	// Return it then
	if(pTexture !is null)
		return *pTexture;
		
	// If not, create a new one
	IDirect3DTexture9 texture;
		
	// Allocate It
	if(FAILED(D3DXCreateTextureFromFileExW(device, fileName.toUTF16z, 
D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, 
D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_DEFAULT, 0, info, NULL, &texture)))
		return null;
		
	// Return it
	return m_textures[fileName] = texture;
}

void Destroy()
{
	foreach(string key; m_textures.keys)
		m_textures[key].Release();
}

// The associative array
IDirect3DTexture9[string] m_textures;



More information about the Digitalmars-d-learn mailing list