# SimConnect_GetLastSentPacketID The **SimConnect\_GetLastSentPacketID** function returns the ID of the last packet sent to the SimConnect server.   ##### Syntax ``` cpp HRESULT SimConnect_GetLastSentPacketID( HANDLE hSimConnect, DWORD* pdwSendID ); ```   ##### Parameters {{< table-wrapper >}} | Parameter | Description | Type | |---------------|---------------------------------------------------------------------|---------| | *hSimConnect* | Handle to a SimConnect object. | Integer | | *pdwSendID* | Pointer to a double word containing the ID of the last sent packet. | Integer | {{< /table-wrapper >}}   ##### Return Values The function returns an **HRESULT**. Possible values include, but are not limited to, those in the following table. {{< table-wrapper >}} | Return value | Description | |--------------|-------------------------| | S\_OK | The function succeeded. | | E\_FAIL | The function failed. | {{< /table-wrapper >}}   ##### Example ``` cpp 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](../structures-and-enumerations/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.