Sign in to follow this  
JimmyRose

DirectInput Joystick

Recommended Posts

JimmyRose    109
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
BLiTZWiNG    361
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this