Original Post
I have been following the sdk docs to the letter yet for some reason it doesnt like the callback function EnumJoysticksCallback() im using when trying to enumerate any joysticks that may be attached to the comp.
Im wrapping all the DInput init in a class. Heres the prototype for the callback function
BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE *pdidInstance, VOID *pContext ); //callback function for use in DInput8::DI_JoystickDevice_Createand here is the declaration in the source file
BOOL CALLBACK DInput8::EnumJoysticksCallback(const DIDEVICEINSTANCE *pdidInstance, VOID *pContext)
{
HRESULT hr;
//found a joystick so need to create a new joystick object for our list
JoystickDI8_headNode->Joystick_DI8_Insert(&JoystickDI8_headNode, &numOfJoysticks);
//the newly created joystick automatically becomes the new headNode by design
//so pass nodeHead address to aquire an interface for new joystick object.
//...Obtain an interface to the enumerated joystick.
hr = lpDI->CreateDevice(pdidInstance->guidInstance,
&JoystickDI8_headNode->lpDIDevice_Joystick, NULL);
if (FAILED(hr))
{
//could not create an interface for this joystick
//so delete this redundant object from list
JoystickDI8_headNode->Joystick_DI8_Delete(&JoystickDI8_headNode, &JoystickDI8_headNode, &numOfJoysticks);
}
//get next joystick if one is available.
return DIENUM_CONTINUE;
}
and now hear it is in use
if (FAILED ( hr = lpDI->EnumDevices(DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback,
NULL, DIEDFL_ATTACHEDONLY)))
{
adamsDXErrorLog("Unable to Enumerate Joystick(s) in DInput8::DI_JoystickDevice_Create()", hr);
}
And this is what the compilers says
c:\data files\programming\games programming\gameprojects\code\dinput8\dinput8.cpp(223) : error C2664: ''EnumDevices'' : cannot convert parameter 2 from ''int (const struct DIDEVICEINSTANCEA *,void *)'' to ''int (__stdcall *)(const struct DIDEVICEINSTANCE
A *,void *)''
basically suggesting the return type is not correct yet ive checked and checked the docs and both prototype and declaration matche word for word what it states in the docs which is BOOL CALLBACK.
Any help greatly appreciated.
Regards
2DamnFunky