The callback prototype:
BOOL CALLBACK ObjectCallback( LPCDIDEVICEOBJECTINSTANCE, VOID*);
The call:
if( FAILED(hr = joystick->EnumObjects( ObjectCallback, NULL, DIDFT_ALL )))
return hr;
The callback function:
BOOL CALLBACK ObjectCallback( LPCDIDEVICEOBJECTINSTANCE ObjectInstance, VOID *context)
{
JSControlData *jscinstance = new JSControlData;
memcpy( jscinstance, ObjectInstance, sizeof( JSControlData ));
jsdata.jscdata.push_back(jscinstance);
// keep going until we get them all.
return DIENUM_CONTINUE;
}
The error:
Unhandled exception at 0x01342e73 in jsfind.exe: 0xC0000005: Access violation reading location 0xccccccd0.
It's happening in xutility, in the _Adopt function of the _Iterator_base12 structure. The parent is going in NULL, but I can't determine why.
If I build in release, it will get one object, then stop responding. And, yes, DI and the stick get created with no errors and I can get the capabilities as well, but I can't get info on each object.
Does anyone have any insight on this problem?
PS: Make that "unhandled" exception. I can't go back and edit the title.