Problems with DirectInput

Published June 25, 2005
Advertisement
I'm having a problem with DirectInput trying to enumerate the axes.


BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,                                 VOID* pContext );if ( FAILED( hr = m_pJoyDev->EnumObjects( EnumAxesCallback,                                               (VOID*)g_hWndMain, DIDFT_AXIS ) ) )        return hr;


Then I get the following compiler error.

error C2664: 'IDirectInputDevice8A::EnumObjects' : cannot convert parameter 1 from 'BOOL (const DIDEVICEOBJECTINSTANCE *,void *)' to 'LPDIENUMDEVICEOBJECTSCALLBACKA'
None of the functions with this name in scope match the target type

I'm not sure what's going on. I took this code straight out of the DirectX samples. The sample compiles, but when I copy the code into my engine, no luck.

I started a thread on Game Dev, Indie Gamer, and IGDA to investigate.
0 likes 2 comments

Comments

Botroid
Just cast the first parameter of IDirectInput8::EnumDevices to DIENUMDEVICEOBJECTSCALLBACK?


BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, 
                                VOID* pContext );



if ( FAILED( hr = m_pJoyDev->EnumObjects( (DIENUMDEVICEOBJECTSCALLBACK)EnumAxesCallback, 
                                              (VOID*)g_hWndMain, DIDFT_AXIS ) ) )
        return hr;





I don't have access to DirectX SDK at the moment, but I'm quite sure that should do the job...
June 25, 2005 05:01 PM
Botroid
Argh, posted reply and accidently deleted it [lol]

Anyways, casting the first parameter that compiler complains about to DIENUMDEVICEOBJECTSCALLBACK should do the job.
June 25, 2005 05:06 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement