CoCancelCall function (combaseapi.h)

Requests cancellation of an outbound DCOM method call pending on a specified thread.


HRESULT CoCancelCall(
  [in] DWORD dwThreadId,
  [in] ULONG ulTimeout


[in] dwThreadId

The identifier of the thread on which the pending DCOM call is to be canceled. If this parameter is 0, the call is on the current thread.

[in] ulTimeout

The number of seconds CoCancelCall waits for the server to complete the outbound call after the client requests cancellation.

Return value

This function can return the standard return values E_FAIL, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following values.

Return code Description
The cancellation request was made.
There is no cancel object corresponding to the specified thread.
Call cancellation is not enabled on the specified thread.
The call was completed during the timeout interval.
The call was already canceled.


CoCancelCall calls CoGetCancelObject and then ICancelMethodCalls::Cancel on the cancel object for the call being executed.

This function does not locate cancel objects for asynchronous calls.

The object server can determine if the call has been canceled by periodically calling CoTestCancel. If the call has been canceled, the object server should clean up and return control to the client.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header combaseapi.h (include Objbase.h)
Library Ole32.lib
DLL Ole32.dll

See also