From X-Plane SDK
XPLM_API void XPLMCommandButtonPress( XPLMCommandButtonID inButton);This function simulates any of the actions that might be taken by pressing a joystick button. However, this lets you call the command directly rather than have to know which button is mapped where. Important: you must release each button you press. The APIs are separate so that you can 'hold down' a button for a fixed amount of time.