ISCardLocate::FindCard

The FindCard method searches for the smart card and opens a valid connection to it.

HRESULT FindCard(
  SCARD_SHARE_MODES ShareMode,
  SCARD_PROTOCOLS Protocols,
  LONG lFlags,
  LPSCARDINFO *ppCardInfo
);
 

Parameters

ShareMode [in, defaultvalue(EXCLUSIVE)]
Mode in which to share or not share the smart card when a connection is opened to it.
Values Description
EXCLUSIVE No one else use this connection to the smart card.
SHARED Other applications can use this connection.

Protocols [in, defaultvalue(T0)]
Protocol to use when connecting to the card.
Values
T0
T1
Raw
T0|T1

lFlags [in, defaultvalue(SC_DLG_NO_UI)]
Specifies when user interface is displayed:
Flag Meaning
SC_DLG_MINIMAL_UI Displays the dialog only if the card being searched for by the calling application is not located and available for use in a reader. This allows the card to be found, connected (either through internal dialog mechanism or the user callback functions), and returned to the calling application.
SC_DLG_NO_UI Causes no UI display, regardless of the search outcome.
SC_DLG_FORCE_UI Causes UI display regardless of the search outcome.

ppCardInfo
[out, retval] Pointer to a data structure that contains/returns information about the opened smart card, if successful. Will be NULL if operation has failed.

Return Values

The possible return values are the following:

Value Meaning
S_OK Public key retrieved successfully.
E_INVALIDARG Invalid parameter.
E_POINTER A bad pointer was passed in ppCardInfo.
E_OUTOFMEMORY Out of memory.

Remarks

To set the search criteria of the search, call ConfigureCardNameSearch to specify a smart card's card names or call ConfigureCardGuidSearch to specify a smart card's interfaces.

For a list of all the methods provided by the ISCardLocate interface, see ISCardLocate.

In addition to the COM error codes listed above, this interface may return a smart card error code if a smart card function was called to complete the request. For information on smart card error codes, see Smart Card Error Codes.

QuickInfo

  Windows NT: Use version 4.0 SP3 and later.
  Windows: Use Windows 95 OSR2.1.
  Windows CE: Unsupported.
  Header: Declared in scardmgr.h.
  Import Library: scardmgr.tlb.

See Also

ConfigureCardNameSearch, ISCardLocate