SCardCancel function (winscard.h)

The SCardCancel function terminates all outstanding actions within a specific resource manager context.

The only requests that you can cancel are those that require waiting for external action by the smart card or user. Any such outstanding action requests will terminate with a status indication that the action was canceled. This is especially useful to force outstanding SCardGetStatusChange calls to terminate.

Syntax

LONG SCardCancel(
  [in] SCARDCONTEXT hContext
);

Parameters

[in] hContext

Handle that identifies the resource manager context. The resource manager context is set by a previous call to SCardEstablishContext.

Return value

This function returns different values depending on whether it succeeds or fails.

Return code Description
Success
SCARD_S_SUCCESS.
Failure
An error code. For more information, see Smart Card Return Values.

Remarks

The SCardCancel function is a smart card tracking function. For a description of other tracking functions, see Smart Card Tracking Functions.

Examples

The following example cancels all outstanding actions in the specified context. The example assumes that lReturn is an existing variable of type LONG and that hContext is a valid handle received from a previous call to SCardEstablishContext.


lReturn = SCardCancel( hContext );
if ( SCARD_S_SUCCESS != lReturn )
    printf("Failed SCardCancel\n");

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winscard.h
Library Winscard.lib
DLL Winscard.dll

See also

SCardEstablishContext

SCardGetStatusChange

SCardLocateCards