Smart Card User Interface

The smart card user interface (UI) is a single common dialog that lets the user specify or search for a smart card to open (that is, connect to and use in an application).

Following are two ways you can use the common dialog. Both assume that the dialog UI will be displayed. (See OPENCARDNAME for more information.)

    To let the user select a smart card to open (that is, connect to and use in the calling application)
  1. Declare a variable of type OPENCARDNAME.
  2. Fill in the appropriate information for the common dialog to narrow the search for a card that the calling application is looking for. This would include specifying lpstrGroupNames, lpstrCardNames, and, in future releases, rgguidInterfaces. This would also include specifying a preferred sharemode and protocol to use when the common dialog connects to the card using the dwShareMode and dwProtocols OPENCARDNAME structure members.
  3. Call the GetOpenCardName function to display the common dialog to the user. A simple help information line will be displayed, and if one of the cards being requested is found, the card will be highlighted in the display. For multiple card name searches, the first reader containing one of the preferred cards will be highlighted.

  4. The user then selects a card, clicks OK, and connects to the smart card.
    To search for a specific card by using the lpfnConnect, lpfnCheck, and lpfnDisconnect callback functions.
  1. Declare a variable of type OPENCARDNAME.
  2. Fill in the appropriate information for the common dialog to use to narrow the search for a card that the calling application seeks. This would include giving lpstrGroupNames, lpstrCardNames, and, in future releases, rgguidInterfaces).
    1. In addition, create the Connect, Check, and Disconnect callback functions and set the lpfnConnect, lpfnCheck, and lpfnDisconnect OPENCARDNAME data members appropriately.

    Note: All three functions and members must be available when using the common dialog in this way.

  3. Call the GetOpenCardName common dialog function.
  4. The common dialog will then look for the requested cards. If a matching card name or ATR string is found, the Connect, Check, and Disconnect callback functions will be called in sequence. If a card passes the Check routine (that is, the Check callback returns TRUE), this card is highlighted in the display to the user.

    Note: If multiple card names are given, the first reader that contains one of the requested cards and passes the Check routine will be the selected card.

  5. If no matches are found, the common dialog seen above will appear.