# SimConnect_CallDispatch The **SimConnect\_CallDispatch** function is used to process the next SimConnect message received, through the specified callback function.   ##### Syntax ``` cpp HRESULT SimConnect_CallDispatch( HANDLE hSimConnect, DispatchProc pfcnDispatch, void * pContext ); ```   ##### Parameters {{< table-wrapper >}} | Parameter | Description | Type | |----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| | *hSimConnect* | Handle to a SimConnect object. | Integer | | *pfcnDispatch* | Specifies the callback function. For a definition of the function see `DispatchProc`. | Integer | | *pContext* | Specifies a pointer that the client can define that will be returned in the callback. This is used in particular by managed code clients to pass a *this* pointer to the callback. | 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 int quit = 0; while( quit == 0 ) { hr = SimConnect_CallDispatch(hSimConnect, MyDispatchProc, NULL); }; ```   ##### Remarks It is important to call this function sufficiently frequently that the queue of information received from the server is processed (typically it is coded within a **while** loop that terminates when the application is exited).