When I try to use the SDK to access FCS information, it seems like DIS entities do not appear. Is there a way to access the ObjectID of that DIS Entity? I am trying to use the PDK to draw a line and some other relevant information for the user.
Example code snippet:
Code: Select all
enum EVENT_ID {
EVENT_RECUR_1SEC,
EVENT_NEXT_TARGET,
};
enum DATA_DEFINE_ID {
DEFINITION_FCS,
};
enum DATA_REQUEST_ID {
REQUEST_FCS,
};
struct Struct1 {
int numTargets;
};
void CALLBACK MyDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void* pContext)
{
HRESULT hr;
switch (pData->dwID)
{
case SIMCONNECT_RECV_ID_SIMOBJECT_DATA:
{
SIMCONNECT_RECV_SIMOBJECT_DATA* pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA*)pData;
switch (pObjData->dwRequestID)
{
case REQUEST_FCS:
Struct1* pS = (Struct1*)&pObjData->dwData;
printf("Number of targets: %i", pS->numTargets);
break;
}
break;
}
default:
printf("\nMissed the case\n");
break;
}
}
HANDLE mSimConnect;
void StartSimConnect()
{
int quit = 0;
if (SUCCEEDED(SimConnect_Open(&mSimConnect, ("DIS_Testing"), NULL, 0, NULL, 0)))
{
SimConnect_AddToDataDefinition(mSimConnect, DEFINITION_FCS, "FCS TARGET LIST COUNT", "number");
SimConnect_RequestDataOnSimObject(mSimConnect, REQUEST_FCS, DEFINITION_FCS, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_SECOND);
SimConnect_CallDispatch(mSimConnect, MyDispatchProc, NULL);
if (quit == 1)
{
SimConnect_Close(mSimConnect);
}
}
else
{
printf("\nCouldnt open simconnect\n");
}
}