The SimConnect_GetLastSentPacketID function returns the ID of the last packet sent to the SimConnect server.

 

Syntax
HRESULT SimConnect_GetLastSentPacketID(
    HANDLE  hSimConnect,
    DWORD*  pdwSendID
    );

 

Parameters
ParameterDescriptionType
hSimConnectHandle to a SimConnect object.Integer
pdwSendIDPointer to a double word containing the ID of the last sent packet.Integer

 

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.

 

Example
DWORD dwLastID;
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_MY_EVENT, "Custom.Event");
hr = SimConnect_TransmitClientEvent(hSimConnect, 0, EVENT_MY_EVENT, 0, SIMCONNECT_GROUP_PRIORITY_HIGHEST, 0);
hr = SimConnect_GetLastSentPacketID(hSimConnect, &dwLastID);

 

Remarks

This function should be used in conjunction with returned structures of type SIMCONNECT_RECV_EXCEPTION to help pinpoint errors (exceptions) returned by the server. This is done by matching the send ID returned with the exception, with the number returned by this function and stored appropriately. This function is primarily intended to be used while debugging and testing the client application, rather than in a final retail build.