How to get value/parameter for Input Event in unmanaged code?

How to you get the double (or string) value for an Input Event?
I am checking the parameter type (eType) and casting as appropriate, but I am always getting a value of 0.0:

			char logMessage[128];
				sprintf(logMessage, "InputEvent received: '%s', Value=%lf (param='%s')", inputEvents[i].name, (double)evt->Value, inputEvents[i].parameter);
				sprintf(logMessage, "InputEvent received: '%s', Value='%s' (param='%s')", inputEvents[i].name, (char*)evt->Value, inputEvents[i].parameter);
				sprintf(logMessage, "InputEvent received: '%s' (param='%s')", inputEvents[i].name, inputEvents[i].parameter);

I have also tried as a float rather than a double, and the result is the same. Not sure if this value should be a float or a double (documentation is confusing on this), or how to read the actual value.
Also, when I enumerate the input event parameters, the parameter value of many input events is returned as an empty string (i.e. no parameters) with the SIMCONNECT_RECV_ID_ENUMERATE_INPUT_EVENT_PARAMS event, but many of these events do in fact take a parameter, and also a parameter is given when you subscribe to receive the Input Event. Why is this?


About the way to get the value, you must not cast the value itself to the right type (double/string) but the pointer to this value, such as :

			double* d = (double*)&evt->Value;
			// ...

About the enumParams part, lots of them don’t have params because they are toggle events. But if you have some examples about an InputEvent defined in an xml file which have some parameters but the API doesn’t return anything, we would love to have it because that means something doesn’t work as expected.

About the subscribe part, I am not sure to understand what you are saying about the parameter given to the subscribe function

Best Regards
Maxime / Asobo

Thank you for your reply - this is now working.

In the King Air, enumerating parameters for FUEL_1_Condition_Lever returns a parameter of FLOAT64, whereas FUEL_2_Condition_Lever returns no parameters:

18579 InputEvent parameter received for 'FUEL_1_Condition_Lever': ';FLOAT64'
18594 InputEvent parameter received for 'FUEL_2_Condition_Lever': ''

However, both except a parameter (2 for cut-off, 1 for low-idle, 0 for high idle). Both work sending the parameter, but one shows no parameter needed.

37204 Executing InputEvent 'FUEL_1_Condition_Lever' [52] with parameter 2.000000
37219 *** EVENT: Cntrl= 67280 (0x000106d0), Param= 0 (0x00000000) SET_FUEL_VALVE_ENG1
37219 InputEvent received: 'FUEL_1_Condition_Lever', Value=2.000000 (param=';FLOAT64')
37329 Executing InputEvent 'FUEL_2_Condition_Lever' [53] with parameter 2.000000
37344 *** EVENT: Cntrl= 67281 (0x000106d1), Param= 0 (0x00000000) SET_FUEL_VALVE_ENG2
37344 InputEvent received: 'FUEL_2_Condition_Lever', Value=2.000000 (param='')

Similarly, ENGINE_Propeller_1 and ENGINE_Propeller_2 show no parameters:

18219 InputEvent parameter received for 'ENGINE_Propeller_1': ''
18219 InputEvent parameter received for 'ENGINE_Propeller_2': ''

But both log values between 0.0 and 100.0:

1113907 InputEvent received: ‘ENGINE_Propeller_2’, Value=20.000000 (param=‘’)
1113938 InputEvent received: ‘ENGINE_Propeller_2’, Value=20.000000 (param=‘’)
1115297 InputEvent received: ‘ENGINE_Propeller_1’, Value=19.956055 (param=‘’)
1115328 InputEvent received: ‘ENGINE_Propeller_1’, Value=20.351562 (param=‘’)
1115360 InputEvent received: ‘ENGINE_Propeller_1’, Value=20.751953 (param=‘’)
1115391 InputEvent received: ‘ENGINE_Propeller_1’, Value=22.006836 (param=‘’)
1115422 InputEvent received: ‘ENGINE_Propeller_1’, Value=23.789062 (param=‘’)
1115469 InputEvent received: ‘ENGINE_Propeller_1’, Value=25.107422 (param=‘’)
1115500 InputEvent received: ‘ENGINE_Propeller_1’, Value=26.489258 (param=‘’)
1115532 InputEvent received: ‘ENGINE_Propeller_1’, Value=27.348633 (param=‘’)
1115563 InputEvent received: ‘ENGINE_Propeller_1’, Value=27.807617 (param=‘’)
1115625 InputEvent received: ‘ENGINE_Propeller_1’, Value=28.266602 (param=‘’)
1115688 InputEvent received: ‘ENGINE_Propeller_1’, Value=28.569336 (param=‘’)

I have come across many such Input Events in various aircraft. Note that this has also been reported in the following topic: Input Event Parameters/EnumerateInputEventParams() boken/unexplained (was: What are Input Event Parameters?)

Thanks for your assistance,


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.