Archived

This topic is now archived and is closed to further replies.

LOWORBIT

DirectInput 8 JOYSTICK init problem

Recommended Posts

I''m have a problem when creating a callback function, e:\alpha\inputdi8.cpp(391) : error C2664: ''EnumDevices'' : cannot convert parameter 2 from ''int (struct DIDEVICEINSTANCEA *,void *)'' to ''int (__stdcall *)(const struct DIDEVICEINSTANCEA *,void *)'' this is what vc++ 6.0 returns, and help would be useful, thanks.

Share this post


Link to post
Share on other sites
I use VC++6 this works

BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE*
pdidInstance, VOID* pContext)
{
HRESULT hr;

// Obtain an interface to the enumerated joystick.
hr = G.lpDI2->CreateDevice(pdidInstance->guidInstance,
&G.lpDIJoystick, NULL);
if(FAILED(hr))
return DIENUM_CONTINUE;

return DIENUM_STOP;
}

hope this helps,, if not ...

->Compiler Error C2664
''function'' : cannot convert parameter number from ''type1'' to ''type2''

The specified parameter of the specified function could not be converted to the required type. If you’ve encountered this error on code which compiled with an earlier version of Visual C++, please read Technote: Improved Conformance to ANSI C++ for more information.

The following is an example of this error:

class A {} a;
func( int, A );
void main()
{
func( 1, 1 ); // error, no conversion from int to A
}

Tips

Recheck the prototype for the given function and correct the argument noted in the error message. If necessary, an explicit conversion may need to be supplied.

The twisted mountian man

NIFTY

Share this post


Link to post
Share on other sites