SimConnect_RetrieveString

The SimConnect_RetrieveString function is used to assist in retrieving variable length strings from a structure.

 

Syntax
HRESULT SimConnect_RetrieveString(
    SIMCONNECT_RECV*  pData,
    DWORD  cbData,
    void*  pStringV,
    char**  ppszString,
    DWORD*  pcbString
    );

 

Parameters
Parameter Description Type
pData Pointer to a SIMCONNECT_RECV structure, containing the data. Pointer
cbData The size of the structure that inherits the SIMCONNECT_RECV structure, in bytes. Integer
pStringV Pointer to a the start of the variable length string within the structure. Pointer
ppszString Specifies a pointer to a pointer to a character buffer that should be large enough to contain the maximum length of string that might be returned. On return this buffer should contain the retrieved string. Pointer
pcbString Pointer to a DWORD. On return this contains the length of the string in bytes. Pointer

 

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
struct StructVS {
    char title[1];
    }
StructVS *pS = (StructVS*)&pObjData->dwData;
char *pszTitle;
DWORD cbTitle;
hr = SimConnect_RetrieveString(pData, cbData, &pS->strings, &pszTitle, &cbTitle)))

 

Remarks

This function does not communicate with the SimConnect server, but is a helper function to assist in the handling of variable length strings. Its counterpart is the SimConnect_InsertString function. Note that this function works in the case where an empty string is in the structure returned by the server.

 

See Also