Direct Input 8 woes....
I am trying to write some DirectX Wrappers and I am having trouble..... I am still new to the whole programming thing so any help would be apreciated... here is my problem....
I have a class called WinterDreamsInput
In WinterDreamsInput
I have a function that looks like this
// This is what I will use to init the joystick
bool WinterDreamsInput::DirectInputInitJoystick(HWND Main_Window_Handle);
and a function that looks like this
// This is a function the Direct input docs say you have to
// have....
WinterDreamsInput::BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE*
pdidInstance, VOID* pContext)
bool WinterDreamsInput::DirectInputInitJoystick(HWND Main_Window_Handle)
{
//First step enum devices
if(dinputobject->EnumDevices(DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, NULL, DIEDFL_ATTACHEDONLY) != DI_OK)
return false;
return true;
}
Ok here is my problem.... I already set the Callback function up but when I compile i get this error....
c:\test\winterdreamsinput.cpp(66) : error C2664: ''EnumDevices'' : cannot convert parameter 2 from ''int (const struct DIDEVICEINSTANCEA *,void *)'' to ''int (__stdcall *)(const struct DIDEVICEINSTANCEA *,void *)''
Can anyone help me out and tell me why I get this error?
Thanks!
i dont really understand callback functions that well, but it seems as if your problem is having a function pointer as a member function, and you can search the forums for some threads on them
You need to use __stdcall modifier. You can get it another way by using WINAPI, which is #defined to __stdcall:
bool __stdcall SomeFn(...);
bool WINAPI SomeFn(...);
I think the second way is the recommended one.
bool __stdcall SomeFn(...);
bool WINAPI SomeFn(...);
I think the second way is the recommended one.
Psybr should be right, you can''t pass a non static method to a callback that expects a non member function. Has been disussed sveral times.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement