I have tried editing the examples and cut & paste here and there but to no avil. Can someone help me spot the error and correct it for me? I am trying to capture, mask and output it to XML. Any help appreciated.
Code:
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <strsafe.h>
#include "SimConnect.h"
int quit = 0;
HANDLE hSimConnect = NULL;
int current = 1;
int sliderpercent = 0;
static enum GROUP_ID {
INPUT_GROUP
};
static enum DATA_REQUEST_ID {
REQUEST_APSTATE,
};
static enum INPUT_ID {
INPUT_SLIDER,
INPUT_Z
};
static enum EVENT_ID {
EVENT_A,
};
void CALLBACK MyDispatchProcJ(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext)
{
HRESULT hr;
switch(pData->dwID)
{
case SIMCONNECT_RECV_ID_EVENT:
{
SIMCONNECT_RECV_EVENT *evt = (SIMCONNECT_RECV_EVENT*)pData;
switch(evt->uEventID)
{
case EVENT_A:
(long)evt->dwData;
sliderpercent = dwData;
break;
case PANEL_SERVICE_PRE_INITIALIZE:
register_named_variable ( "FBWELEV99" );
break;
case PANEL_SERVICE_PRE_UPDATE:
sliderpercent = check_named_variable ( "FBWELEV99" ) ;
break;
default:
break;
}
break;
}
case SIMCONNECT_RECV_ID_QUIT:
{
quit = 1;
break;
}
default:
break;
}
}
void testInput()
{
HRESULT hr;
if (SUCCEEDED(SimConnect_Open(&hSimConnect, "Joystick Input", NULL, 0, 0, 0)))
{
printf("\nConnected to Flight Simulator!");
// Set up a data definition for the throttle control
// Set up some private events
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_A,"AXIS_AILERONS_SET");
// Add all the private events to a notifcation group
//hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_0, EVENT_A);
hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, INPUT_GROUP, EVENT_A,true);
// Set a high priority for the group
hr = SimConnect_SetNotificationGroupPriority(hSimConnect, INPUT_GROUP, SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE);
// Turn all the joystick events off
//hr = SimConnect_SetInputGroupState(hSimConnect,INPUT_GROUP, SIMCONNECT_STATE_OFF);
while( 0 == quit )
{
SimConnect_CallDispatch(hSimConnect, MyDispatchProcJ, NULL);
Sleep(1);
}
hr = SimConnect_Close(hSimConnect);
}
}
int __cdecl _tmain(int argc, _TCHAR* argv[])
{
testInput();
return 0;
}
Code:
1>------ Build started: Project: Joystick Input, Configuration: Debug Win32 ------
1> athr.cpp
1>d:\program files\microsoft games\microsoft flight simulator x sdk\sdk\core utilities kit\simconnect sdk\samples\joystick input\joystick input\athr.cpp(57): error C2065: 'dwData' : undeclared identifier
1>d:\program files\microsoft games\microsoft flight simulator x sdk\sdk\core utilities kit\simconnect sdk\samples\joystick input\joystick input\athr.cpp(60): error C2065: 'PANEL_SERVICE_PRE_INITIALIZE' : undeclared identifier
1>d:\program files\microsoft games\microsoft flight simulator x sdk\sdk\core utilities kit\simconnect sdk\samples\joystick input\joystick input\athr.cpp(60): error C2051: case expression not constant
1>d:\program files\microsoft games\microsoft flight simulator x sdk\sdk\core utilities kit\simconnect sdk\samples\joystick input\joystick input\athr.cpp(61): error C3861: 'register_named_variable': identifier not found
1>d:\program files\microsoft games\microsoft flight simulator x sdk\sdk\core utilities kit\simconnect sdk\samples\joystick input\joystick input\athr.cpp(64): error C2065: 'PANEL_SERVICE_PRE_UPDATE' : undeclared identifier
1>d:\program files\microsoft games\microsoft flight simulator x sdk\sdk\core utilities kit\simconnect sdk\samples\joystick input\joystick input\athr.cpp(64): error C2051: case expression not constant
1>d:\program files\microsoft games\microsoft flight simulator x sdk\sdk\core utilities kit\simconnect sdk\samples\joystick input\joystick input\athr.cpp(65): error C3861: 'check_named_variable': identifier not found

