Original Post
Ok. My code compiles fine but I can''t use Direct Input because this function (DirectInput8Create() ) fails. Here is my code:
When run, it doesn''t return any of the possible return values for DirectInput8Create(), instead DirectInput8Create() returns E_POINTER (An invalid pointer, usually NULL, was passed as a parameter). p_Config.hinst gets it value from the hinstance of the program (Config.hinst = hinstance
. This is part of a class. LPDIRECTINPUT8 DInput is a private member of the class. Any ideas?
Thanks,
eco
HRESULT hr;
hr = DirectInput8Create(p_Config.hinst, DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)DInput, NULL);
if(FAILED(hr))
{
if(hr == DIERR_INVALIDPARAM)
Debug += "*** DirectInput8Create() FAILED *** Invalid Params";
else if(hr == DIERR_BETADIRECTINPUTVERSION)
Debug += "*** DirectInput8Create() FAILED *** Beta Direct Input Version";
else if(hr == DIERR_OLDDIRECTINPUTVERSION)
Debug += "*** DirectInput8Create() FAILED *** Old Direct Input Version";
else if(hr == DIERR_OUTOFMEMORY)
Debug += "*** DirectInput8Create() FAILED *** Out of Memory";
else
{
char buffer[512];
sprintf(buffer, "%s", DXGetErrorString8(hr));
char buffer2[512];
sprintf(buffer2, "*** DirectInput8Create() FAILED *** Error: %s", buffer);
Debug += buffer2;
}
return false;
|