.NET
  Home arrow .NET arrow Page 4 - Smart Cards in .NET
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Smart Cards in .NET
By: Digvijay Chauhan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 102
    2004-03-15

    Table of Contents:
  • Smart Cards in .NET
  • The Solution
  • Three More Methods
  • A New Reference
  • The Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Smart Cards in .NET - A New Reference


    (Page 4 of 5 )

    And as you click the OK button a new reference is added to the project as shown below:

    Smart cards

    You may add a using or imports directive to include this namespace to your current files and use this class without really worrying about the details. The Interop generates the code such that the types available perfectly match the interface methods prototypes, which was the biggest hurdle in using P/Invoke.

    I issued some commands using the buttons as in the image below. It responded well by returning the appropriate results. I’ve not written the whole business logic code for the application but just how the application would use this Interop generated class.

    As soon as the Select Reader button is clicked the following code opens a reader selection Dialog.  Once the user selects and clicks the Ok button it tries to open the reader.

    Smart cards


    private void BtnSelectAndOpenReader_Click(object senderSystem.EventArgs e)
    {
     try
     
    {
      m_strReaderName 
    Reader.SelectReader();
      
      
    if(m_strReaderName.Length 0)
      
    {
       
    if( Reader.OpenReader() == )
       
    {
        m_bIsReaderOpen 
    true;
        mcsStatusBar
    .Text "Reader opened successfully";
        string strRes
    ;
    int nResLen 
    =Reader.SendCommand("00A4040007A0000000031010"12,out strRes);
       
    }
      
    }
     
    }
     
    catch(System.Exception ex)
     
    {
    MessageBox
    .Show(this.Owner ,"An error has occured:nn" ex.ToString()+ "nnError Message : " ex.Message );
     
    }
    }

    More .NET Articles
    More By Digvijay Chauhan


     

    .NET ARTICLES

    - Building Applications with Windows Workflow ...
    - Building the Data and Business Layers Using ...
    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek