The SimConnect_CallCommBusEvent function is used to call a communication (CommBus) event.

 

C++ C#

Syntax
HRESULT SimConnect_CallCommBusEvent(
    HANDLE hSimConnect,
    const char * EventName,
    SIMCONNECT_COMM_BUS_BROADCAST_TO BroadcastTo,
    DWORD BufferSize,
    const char * Data
    );

 

Parameters
ParameterDescriptionType
hSimConnectHandle to a SimConnect object.Integer
EventNameSpecifies the name of the event to call. Name of the event to call. Note that there is no need to register the event in the client prior to calling it.Integer
BroadcastToOne of the SIMCONNECT_COMM_BUS_BROADCAST_TO enum members that defines where the event should be broadcast (WASM, JS, or SimConnect).Integer
BufferSizeThis is the size (in bytes) of the Data buffer.Integer
Data

This is the data to send alongside the event. The data will be received differently depending on the receiving platform:

  • SimConnect C# - A string will be received.
  • SimConnect C++ - A char string and a size will be received.
  • JavaScript - A string will be received.
  • WASM - A char string and a size will be received.
String

 

Return Values

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return valueDescription
S_OKThe function succeeded.
E_FAILThe function failed.

  

Syntax
void SimConnect::CallCommBusEvent(
    string EventName,
    SIMCONNECT_COMM_BUS_BROADCAST_TO BroadcastTo,
    object Data
    );

 

Parameters
ParameterDescriptionType
EventNameSpecifies the name of the event to call. Note that there is no need to register the event in the client prior to calling it.String
BroadcastToOne of the SIMCONNECT_COMM_BUS_BROADCAST_TO enum members that defines where the event should be broadcast (WASM, JS, or SimConnect).Enum
Data

An abstract object containing the data to send with the event, which will be will be converted with Marshal into a pointer and a size. The data will be received differently depending on the receiving platform:

  • SimConnect C# - A string will be received.
  • SimConnect C++ - A char string and a size will be received.
  • JavaScript - A string will be received.
  • WASM - A char string and a size will be received.
Object

 

Return Values

N/A (use a try/catch to test for errors).

 

 

Remarks

N/A