EVENT API
The Microsoft Flight Simulator 2024 Event API permits you to trigger different kinds of key events. This API replaces some features provided by the deprecated Gauge API.
The functions available for this API are as follows:
| Function | Description |
|---|---|
fsEventsTriggerKeyEvent |
Trigger a Key Event. |
fsEventsRegisterKeyEventHandler |
Register a Key Event handler which will receive all Key Events raised by the simulation. |
fsEventsUnregisterKeyEventHandler |
Unregister a Key Event handler that has been previously registered. |
You can find a sample project to use as a reference when using the Event API here:
Typedefs
When using this API the following typedefs exist to help:
-
FsEventId
The ID of an Event. The list of all available IDs can be found in
MSFS/Types/MSFS_EventsEnum.h.typedef int FsEventId;
-
FsEventsKeyEventHandler
Callback signature for the key event handler, where:
typedef void(*FsEventsKeyEventHandler)(FsEventId eventId, FsVarParamArray* param, void* userParam);Parameters Description eventIdID of the received event. paramThe value received with the event. Value can be indexorFsCRC. To manage this type, helper functions can be found inMSFS/Utils/SimParamArrayHelper.h.userParamThe pointer data that will be given to the user who has register the handler.