Export (0) Print
Expand All
COM
Expand Minimize

CoTestCancel function

Determines whether the call being executed on the server has been canceled by the client.

Syntax


HRESULT CoTestCancel(void);

Parameters

This function has no parameters.

Return value

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

Return codeDescription
RPC_S_CALLPENDING

The call is still pending and has not yet been canceled by the client.

RPC_E_CALL_CANCELED

The call has been canceled by the client.

 

Remarks

Server objects should call CoTestCancel at least once before returning to detect client cancellation requests. Doing so can save the server unnecessary work if the client has issued a cancellation request, and it can reduce the client's wait time if it has set the cancel timeout as RPC_C_CANCEL_INFINITE_TIMEOUT. Furthermore, if the server object detects a cancellation request before returning from a pending call, it can clean up any memory, marshaled interfaces, or handles it has created or obtained.

CoTestCancel calls CoGetCallContext to obtain the ICancelMethodCalls interface on the current cancel object and then calls ICancelMethodCalls::TestCancel. Objects that implement custom marshaling should first call CoSwitchCallContext to install the appropriate call context object.

This function does not test cancellation for asynchronous calls.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Objbase.h

Library

Ole32.lib

DLL

Ole32.dll

See also

ICancelMethodCalls

 

 

Community Additions

ADD
Show:
© 2014 Microsoft