March 30, 201016 yr Commercial Member Hi,I've been messing around with SimConnect (from within a gauge) for a few weeks now and was able to do everything I planned to do so far except for retrieving the name of the currently loaded flight. static enum EVENT{ EVENT_FLIGHT_LOADED, EVENT_FLIGHT_SAVED,};void OpenSimConnect(){ HRESULT hr; if (SUCCEEDED(SimConnect_Open(&hSimConnect, "SimCheck SimConnect", NULL, 0, 0, 0))) { hr = SimConnect_SubscribeToSystemEvent(hSimConnect, EVENT_FLIGHT_LOADED, "FlightLoaded"); hr = SimConnect_SubscribeToSystemEvent(hSimConnect, EVENT_FLIGHT_SAVED, "FlightSaved"); SimConnect_CallDispatch(hSimConnect, SCDispatchProc, NULL); }}void CALLBACK SCDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext){ switch(pData->dwID) { //FLIGHT SAVE case SIMCONNECT_RECV_ID_EVENT_FILENAME: { SIMCONNECT_RECV_EVENT_FILENAME *evt = (SIMCONNECT_RECV_EVENT_FILENAME*)pData; switch(evt->uEventID) { case EVENT_FLIGHT_LOADED: sprintf(loadname, "%s", evt->szFileName); LoadAircraftData(); break; case EVENT_FLIGHT_SAVED: sprintf(savename, "%s", evt->szFileName); SaveAircraftData(); break; default: break; } break; } default: break; }} Unfortunately the EVENT_FLIGHT_LOADED event NEVER occurs ! EVENT_FLIGHT_SAVED works fine!Has anyone been able to get this to work ?Thx,Bj Bj
April 6, 201016 yr Commercial Member LOL... not even going to say what the problem was, how it was fixed?? Ed Wilson Mindstar AviationMy Playland - I69
April 9, 201016 yr Commercial Member LOL... not even going to say what the problem was, how it was fixed??I'll answer for Bj Win10: 22H2 19045.2728 CPU: 9900KS at 5.5GHz Memory: 32Gb at 3800 MHz. GPU: RTX 24Gb Titan 2 x 2160p projectors at 25Hz onto 200 FOV curved screen
April 10, 201016 yr Author Commercial Member He is using SimConnect in a Gauge. Gauges are loaded when the flight is loaded, but of course are not yet connected when the "FlightLoaded" event occurs. He just needed instead to get the FlightLoaded system state upon initialisation.Sorry guys, and thx Pete. Yes the FlightLoaded event doesn't occur because the gauge is reloaded completely when a new flight is loaded !I now retrieve the current flightname during the SimConnect initialization.Bj Bj
Create an account or sign in to comment