The SimConnect_SetClientData function is used to write one or more units of data to a client data area.

 

Syntax
HRESULT SimConnect_SetClientData(
    HANDLE  hSimConnect,
    SIMCONNECT_CLIENT_DATA_ID  ClientDataID,
    SIMCONNECT_CLIENT_DATA_DEFINITION_ID  DefineID,
    DWORD  Flags,
    DWORD  dwReserved,
    DWORD  cbUnitSize,
    void*  pDataSet
    );

 

Parameters
ParameterDescriptionType
hSimConnectHandle to a SimConnect object.Integer
ClientDataIDSpecifies the ID of the client data area.Integer
DefineIDSpecifies the ID of the client defined client data definition.Integer
FlagsNull, or one or more of the flags listed in the table below.Flag
dwReservedReserved for future use. Set to zero.Integer
cbUnitSizeSpecifies the size of the data set in bytes. The server will check that this size matches exactly the size of the data definition provided in the DefineID parameter. An exception will be returned if this is not the case.Integer
pDataSetPointer to the data that is to be written. If the data is not in tagged format, this should point to the block of client data. If the data is in tagged format this should point to the first tag name (datumID), which is always four bytes long, which should be followed by the data itself. Any number of tag name/value pairs can be specified this way, the server will use the cbUnitSize parameter to determine how much data has been sent.Integer

 

The following table shows the different flags that can be used:

FlagDescription
NULLDo nothing.
SIMCONNECT_DATA_SET_FLAG_TAGGEDThe data to be set is being sent tagged format. If this flag is not set then the entire client data area should be replaced with new data. Refer to the pDataSet parameter and SimConnect_RequestClientData for more details on the tagged format.

 

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.

 

Remarks

A data definition must be specified, using the SimConnect_AddToClientDataDefinition function, before data can be set.