CoCancelCall

[This is preliminary documentation and subject to change.]

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

HRESULT CoCancelCall(
  DWORD dwThreadID  //Thread issuing call
);
 

Parameter

dwThreadID
Identifier of the thread on which the pending COM call is to be canceled. If 0, the call is on the current thread.

Return Values

This function supports the standard return values E_FAIL, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:

S_OK
The cancellation request was made.
E_NOINTERFACE
There is no cancel object corresponding to the specified thread.
RPC_E_CALL_COMPLETE
The call has already returned.
RPC_E_CALL_CANCELED
The call was canceled earlier.

Remarks

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

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.

This function does not locate cancel objects for asynchronous calls.

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in objbase.h.
  Import Library: Use ole32.lib.