Hallo,
Ich habe ein kleines Problem beim entwickeln einer Klasse.
Wenn ich D3DXCreateTextureFromFile aufrufe, wird immer
d3dxerr_invaliddata zurückgegeben. Die Textur ist im gleichen Ordner
wie die DLL.
Code :
Ich habe ein kleines Problem beim entwickeln einer Klasse.
Wenn ich D3DXCreateTextureFromFile aufrufe, wird immer
d3dxerr_invaliddata zurückgegeben. Die Textur ist im gleichen Ordner
wie die DLL.
Code :
Code:
#include <Windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#pragma once
#pragma comment(lib,"d3d9.lib")
#pragma comment(lib,"d3dx9.lib")
LPD3DXSPRITE sprite;
LPDIRECT3DTEXTURE9 gTexture;
void Init(LPDIRECT3DDEVICE9 pDevice,LPCTSTR path);
DWORD WINAPI Func(LPVOID lpParam);
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved )
{
if(fdwReason == DLL_PROCESS_ATTACH)
{
CreateThread(0,0,Func,0,0,0);
break;
}
return TRUE;
}
void Init(LPDIRECT3DDEVICE9 pDevice,LPCTSTR path)
{
gTexture = NULL;
sprite = NULL;
HRESULT h1 = D3DXCreateSprite(pDevice,&sprite);
if(h1 != S_OK)
{
MessageBox(NULL,L"Failed to Create Sprite",NULL,NULL);
}
HRESULT h2 = D3DXCreateTextureFromFile(pDevice,path,&gTexture);
if(h2 != D3D_OK)
{
if(h2 == D3DERR_NOTAVAILABLE){MessageBox(NULL,L"D3DERR_NOTAVAIBLE",0,0); }
if(h2 == D3DERR_OUTOFVIDEOMEMORY){MessageBox(NULL,L"D3DERR_OUTOFVIDEOMEMORY",0,0); }
if(h2 == D3DERR_INVALIDCALL){MessageBox(NULL,L"D3DERR_INVALIDCALL",0,0); }
if(h2 == D3DERR_INVALIDCALL){MessageBox(NULL,L"D3DERR_INVALIDCALL",0,0); }
if(h2 == D3DXERR_INVALIDDATA){MessageBox(NULL,L"D3DXERR_INVALIDDATA",0,0); }
}
}
DWORD WINAPI Func(LPVOID lpParam)
{
Init(/*Address of EndScene*/,"haha.png");
return 0;
}