Original Post
Hi ! I have a problem with my function EnumDevice for listing of joystick. I do the same thing than many samples I see on the web. The error from Visual-Studio is... \joystick.cpp(22): error C2664: 'IDirectInput8A::EnumDevices' : cannot convert parameter 2 from 'BOOL (const DIDEVICEINSTANCE *,void *)' to 'LPDIENUMDEVICESCALLBACKA' My 2 functions are.... ----------------------- bool CJoystick::Create(LPDIRECTINPUT8 pDI) { DIPROPRANGE DIprg; DIPROPDWORD DIpdw; if( pDI->EnumDevices( DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, NULL, DIEDFL_ATTACHEDONLY ) ) return false; if( m_pDIJoystick->SetDataFormat( &c_dfDIJoystick ) != DI_OK ) return false; if( m_pDIJoystick->SetCooperativeLevel( GetUserInputs()->GetEngine()->GetWindows(), DISCL_FOREGROUND | DISCL_EXCLUSIVE) != DI_OK ) return false; .... bla bla.... and my Callback function is.... -------------------------------- BOOL CALLBACK CJoystick::EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, VOID* pContext) { UNREFERENCED_PARAMETER( pContext ); // Create a joystick interface. if( m_pUserInputs->m_pDI->CreateDevice( pdidInstance->guidInstance, &m_pDIJoystick, NULL) != DI_OK ) return DIENUM_CONTINUE; return DIENUM_STOP; } I found on the web that error C2664 is a Microsoft bug with VS 2003. Problem of call of good constructor... and don't really understand the issue or the solution. Can someone has encountered this error and what was your solution ? Thank you.