The SimConnect_CallDispatch function is used to process the next SimConnect message received, through the specified callback function.


HRESULT SimConnect_CallDispatch(
    HANDLE  hSimConnect,
    DispatchProc  pfcnDispatch,
    void *  pContext


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


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.


int quit = 0;
while( quit == 0 ) {  
    hr = SimConnect_CallDispatch(hSimConnect, MyDispatchProc, NULL);



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). Please note that in a WASM environment, this function can only be called once.


See Also