Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.
By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

//------------------------------------------------------------------------------
//
// SimConnect System Event Sample
//
// Description:
// Request a FlightLoaded system event
//------------------------------------------------------------------------------
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <strsafe.h>
#include "SimConnect.h"
int quit = 0;
HANDLE hSimConnect = NULL;
static enum EVENT_ID2 {
EVENT_SIM_START,
EVENT_SIM_STOP,
EVENT_ESC,
};
static enum GROUP_ID {
GROUP_ESC,
};
static enum INPUT_ID {
INPUT_ESC,
};
void CALLBACK MyDispatchProc2(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_SIM_START:
printf("\nSim Start");
hr = SimConnect_SetInputGroupState(hSimConnect, INPUT_ESC, SIMCONNECT_STATE_ON);
break;
case EVENT_SIM_STOP:
printf("\nSIM Stop");
hr = SimConnect_SetInputGroupState(hSimConnect, INPUT_ESC, SIMCONNECT_STATE_OFF);
break;
case EVENT_ESC:
printf("\nESC pressed - do something");
break;
default:
break;
}
break;
}
case SIMCONNECT_RECV_ID_QUIT:
{
quit = 1;
break;
}
default:
break;
}
}
void testSystemEvent()
{
HRESULT hr;
if (SUCCEEDED(SimConnect_Open(&hSimConnect, "System Event", NULL, 0, 0, 0)))
{
printf("\nConnected to Flight Simulator!");
// Create some private events
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_ESC);
// Link the private events to keyboard keys, and ensure input events are off
hr = SimConnect_MapInputEventToClientEvent(hSimConnect, INPUT_ESC, "Esc", EVENT_ESC);
hr = SimConnect_SetInputGroupState(hSimConnect, INPUT_ESC, SIMCONNECT_STATE_OFF);
// Sign up for notifications
hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_ESC, EVENT_ESC);
hr = SimConnect_SubscribeToSystemEvent(hSimConnect, EVENT_SIM_START, "SimStart");
hr = SimConnect_SubscribeToSystemEvent(hSimConnect, EVENT_SIM_STOP, "SimStop");
while( 0 == quit )
{
SimConnect_CallDispatch(hSimConnect, MyDispatchProc2, NULL);
Sleep(1);
}
hr = SimConnect_Close(hSimConnect);
}
}
int __cdecl _tmain(int argc, _TCHAR* argv[])
{
testSystemEvent();
return 0;
}

