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


HRESULT SimConnect_SetClientData(
    HANDLE  hSimConnect,
    DWORD  Flags,
    DWORD  dwReserved,
    DWORD  cbUnitSize,
    void*  pDataSet


Parameter Description Type
hSimConnect Handle to a SimConnect object. Integer
ClientDataID Specifies the ID of the client data area. Integer
DefineID Specifies the ID of the client defined client data definition. Integer
Flags Null, or one or more of the flags listed in the table below. Flag
dwReserved Reserved for future use. Set to zero. Integer
cbUnitSize Specifies 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
pDataSet Pointer 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:

Flag Description
NULL Do nothing.
SIMCONNECT_DATA_SET_FLAG_TAGGED The 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 value Description
S_OK The function succeeded.
E_FAIL The function failed.



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


See Also