Demo: LVAR write access for any aircraft control

Thanks for the great work VFRMau !

I tried that but I’m still facing an issue.

I have an external program that registers and transmits an 0x11000 event :

hr = SimConnect_MapClientEventToSimEvent(hSimConnect,EVENT_TOGGLE_BARO_UNITS,“0x11000”);
SimConnect_TransmitClientEvent(hSimConnect, SIMCONNECT_OBJECT_ID_USER, EVENT_TOGGLE_BARO_UNITS, 0, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);

I see in debug that event in the debug console :

Unfortunatly, it doesn’t get into my switch case. I logged before the switch and get some output so I’m sure the eventHandler is registered :

static void FSAPI EventHandler(ID32 event, UINT32 evenData, PVOID userData) {
switch (event) {
case BARO_TOGGLE_UNITS:
fprintf(stderr, “In BARO_TOGGLE_UNITS event”);
ID baroSelector_ID = check_named_variable(“XMLVAR_Baro_Selector_HPA_1”);
FLOAT64 baroSelector_value = get_named_variable_value(baroSelector_ID);
fprintf(stderr, “In Baro selector value %f”, baroSelector_value);
set_named_variable_value(baroSelector_ID, !baroSelector_value);
}
}

register_key_event_handler((GAUGE_KEY_EVENT_HANDLER)EventHandler, NULL);

Any hint on that ? thanks :wink:

PS: Sorry the preformated text did not work