Smart Cards in .NET - The Solution
(Page 2 of 5 )
I have used ATL to develop the component but anyone using the component need not know any COM or ATL details. If you know them it’s a plus because you can modify the component to suit your needs. I’ve tried to encapsulate enough of the WinSCard API to write a Smart Card enabled application, but there are too many possibilities. So I’ve provided the source code to the component that you can modify and use. Also provided is a sample MFC application, another in Visual Basic 6.0 and a .NET application that successfully uses the WinSCard.dll to communicate to the Smart Card Reader.
As a plus it's implemented as a Dual interface so even scripting clients, like JScript and VB Script, can use it.
All the workings are encapsulated in a single class CPCSCReader, exposing a single interface IPCSCReader.The Class Diagram is displayed below:

Figure 1 The CPCSCReader Class
As one can infer from the class Diagram there are two public properties that can be used to identify whether the reader has a card in it and whether it is powered on. I’ve provided a constructor other than the default constructor, which only accepts reader name as its parameter. There are eight other public methods that can be used to communicate with the smart card reader and manage the UI notifications displayed to the user of the application.
Next: Three More Methods >>
More .NET Articles
More By Digvijay Chauhan