SimConnect_MapClientEventToSimEvent
The SimConnect_MapClientEventToSimEvent function associates a client defined event ID with a Microsoft Flight Simulator event name.
Syntax
HRESULT SimConnect_MapClientEventToSimEvent(
HANDLE hSimConnect,
SIMCONNECT_CLIENT_EVENT_ID EventID,
const char* EventName
);
Parameters
Parameter | Description | Type |
---|---|---|
hSimConnect | Handle to a SimConnect object. | Integer |
EventID | Specifies the ID of the client event. | Integer |
EventName |
Specifies the Microsoft Flight Simulator event name. Refer to the Event IDs document for a list of event names (listed under String Name). If the event name includes one or more periods (such as "Custom.Event" in the example below) then they are custom events specified by the client, and will only be recognized by another client (and not Microsoft Flight Simulator) that has been coded to receive such events. No Microsoft Flight Simulator events include periods. If no entry is made for this parameter, the event is private to the client. Alternatively enter a decimal number in the format "#nnnn" or a hex number in the format "#0xnnnn", where these numbers are in the range THIRD_PARTY_EVENT_ID_MIN and THIRD_PARTY_EVENT_ID_MAX, in order to receive events from third-party add-ons to Flight Simulator X. |
Integer |
Return Values
The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.
Return value | Description |
---|---|
S_OK | The function succeeded. |
E_FAIL | The function failed. |
Example
static enum EVENT_ID {
EVENT_PAUSE,
EVENT_BRAKES,
EVENT_CUSTOM,
EVENT_PRIVATE,
};
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_BRAKES, "brakes");
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_PAUSE, "pause_toggle");
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_CUSTOM, "Custom.Event");
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_PRIVATE);
Remarks
It is important to call this function sufficiently frequently that the queue of information received from the server is processed. If there are no messages in the queue, the [dwID] parameter will be set to SIMCONNECT_RECV_ID_NULL
.
See Also