SCardGetStatusChangeA function (winscard.h)
The SCardGetStatusChange function blocks execution until the current availability of the cards in a specific set of readers changes.
The caller supplies a list of readers to be monitored by an SCARD_READERSTATE array and the maximum amount of time (in milliseconds) that it is willing to wait for an action to occur on one of the listed readers. Note that SCardGetStatusChange uses the user-supplied value in the dwCurrentState members of the rgReaderStatesSCARD_READERSTATE array as the definition of the current state of the readers. The function returns when there is a change in availability, having filled in the dwEventState members of rgReaderStates appropriately.
Syntax
LONG SCardGetStatusChangeA(
[in] SCARDCONTEXT hContext,
[in] DWORD dwTimeout,
[in, out] LPSCARD_READERSTATEA rgReaderStates,
[in] DWORD cReaders
);
Parameters
[in] hContext
A handle that identifies the resource manager context. The resource manager context is set by a previous call to the SCardEstablishContext function.
[in] dwTimeout
The maximum amount of time, in milliseconds, to wait for an action. A value of zero causes the function to return immediately. A value of INFINITE causes this function never to time out.
[in, out] rgReaderStates
An array of SCARD_READERSTATE structures that specify the readers to watch, and that receives the result.
To be notified of the arrival of a new smart card reader, set the szReader member of a SCARD_READERSTATE structure to "\\?PnP?\Notification", and set all of the other members of that structure to zero.
[in] cReaders
The number of elements in the rgReaderStates array.
Return value
This function returns different values depending on whether it succeeds or fails.
Return code | Description |
---|---|
|
SCARD_S_SUCCESS. |
|
An error code. For more information, see Smart Card Return Values. |
Remarks
The SCardGetStatusChange function is a smart card tracking function. For more information about other tracking functions, see Smart Card Tracking Functions.
Examples
For information about how to call this function, see the example in SCardLocateCards.
Note
The winscard.h header defines SCardGetStatusChange as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
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 |