Sign in to follow this  

DirectInput Joystick

This topic is 2897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have a problem trying to get my DirectInput to work with a joystick. I'm using the DirectX SDK tutorial and by step two I have an error I'm unfamiliar with. error C2664: 'IDirectInput8A::EnumDevices' : cannot convert parameter 2 from 'BOOL (__stdcall CDirectX::* )(const DIDEVICEINSTANCE *,void *)' to 'LPDIENUMDEVICESCALLBACKA' 1> There is no context in which this conversion is possible Here's my code which is basically from the SDK: BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pDIInst, VOID* pContext) { HRESULT hr; // Obtain an interface to the enumerated joystick. hr = din->CreateDevice(pDIInst->guidInstance, &joystick, NULL); // If it failed, then we can't use this joystick. (Maybe the user unplugged // it while we were in the middle of enumerating it.) if(FAILED(hr)) return DIENUM_CONTINUE; // Stop enumeration. Note: we're just taking the first joystick we get. // You could store all the enumerated joysticks and let the user pick. return DIENUM_STOP; } // Look for the first simple joystick we can find. hr = din->EnumDevices( DI8DEVCLASS_GAMECTRL, &CDirectX::EnumJoysticksCallback, NULL, DIEDFL_ATTACHEDONLY);

Share this post


Link to post
Share on other sites
I'm gonna take a wild stab in the dark and assume that &CDirectX::EnumJoysticksCallback doesn't result in a pointer to a pointer, and that EnumDevices() wants one?

No I'm wrong there.

Is CDirectX::EnumJoysticksCallback a static method maybe? Otherwise I'd say you'd have to pass an instance of a class, which I don't remember how to do. Or it needs to be static. Somethin' like that.

Share this post


Link to post
Share on other sites
Sign in to follow this