SimConnect_TransmitClientEvent
The SimConnect_TransmitClientEvent function is used to request that the Microsoft Flight Simulator server transmit to all SimConnect clients the specified client event.
Syntax
HRESULT SimConnect_TransmitClientEvent(
HANDLE hSimConnect,
SIMCONNECT_OBJECT_ID ObjectID,
SIMCONNECT_CLIENT_EVENT_ID EventID,
DWORD dwData,
SIMCONNECT_NOTIFICATION_GROUP_ID GroupID,
SIMCONNECT_EVENT_FLAG Flags
);
Parameters
Parameter | Description | Type |
---|---|---|
hSimConnect | Handle to a SimConnect object. | Integer |
ObjectID | Specifies the ID of the server defined object. If this parameter is set to SIMCONNECT_OBJECT_ID_USER , then the transmitted event will be sent to the other clients in priority order. If this parameters contains another object ID, then the event will be sent direct to that sim-object, and no other clients will receive it. |
Integer |
EventID | Specifies the ID of the client event. | Integer |
dwData | Double word containing any additional number required by the event. This is often zero. If the event is a Microsoft Flight Simulator event, then refer to the Event IDs document for information on this additional value. If the event is a custom event, then any value put in this parameter will be available to the clients that receive the event. | Integer |
GroupID | The default behavior is that this specifies the GroupID of the event. The SimConnect server will use the priority of this group to send the message to all clients with a lower priority. To receive the event notification other SimConnect clients must have subscribed to receive the event. See the explanation of SimConnect Priorities. The exception to the default behavior is set by the SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY flag, described below. |
Integer |
Flags | One or more of the flags shown in the table below. | Integer |
The following table shows the different flags that can be used:
Flag | Description |
---|---|
0 | Do nothing. |
SIMCONNECT_EVENT_FLAG_SLOW_REPEAT_TIMER | The flag will effectively reset the repeat timer to simulate slow repeat. Use this flag to reset the repeat timer that works with various keyboard events and mouse clicks. |
SIMCONNECT_EVENT_FLAG_FAST_REPEAT_TIMER | The flag will effectively reset the repeat timer to simulate fast repeat. |
SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY | Indicates to the SimConnect server to treat the GroupID as a priority value. If this flag is set, and the GroupID parameter is set to SIMCONNECT_GROUP_PRIORITY_HIGHEST then all client notification groups that have subscribed to the event will receive the notification (unless one of them masks it). The event will be transmitted to clients starting at the priority specified in the GroupID parameter, though this can result in the client that transmitted the event, receiving it again. |
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_MY_EVENT
EVENT_DME
};
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_MY_EVENT, "Custom.Event");
SimConnect_TransmitClientEvent(hSimConnect, 0, EVENT_MY_EVENT, 0, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_DME, "DME_SELECT");
SimConnect_TransmitClientEvent(hSimConnect, 0, EVENT_DME, 2, SIMCONNECT_GROUP_PRIORITY_DEFAULT, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
Remarks
Typically use this function to transmit an event to other SimConnect clients, including the simulation engine, although the client that transmits the event can also receive it. The order in which client notification groups are informed of the event is determined by the priority of each group. The higher the priority of the group, the earlier it will receive the event notification. Refer to the explanation of the maskable parameter for the SimConnect_AddClientEventToNotificationGroup call, which describes when the event may be masked and not transmitted to lower priority groups. Also see the explanation of SimConnect Priorities.
See Also