Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
VB
'Establish context and obtain hContext handle
       retcode = ModWinsCard.SCardEstablishContext(ModWinsCard.SCARD_SCOPE_USER, 0, 0, hContext)
       If retcode <> ModWinsCard.SCARD_S_SUCCESS Then
           MessageBox.Show(" Could not establish Connection")
           RichTextBoxLogs.Clear()
           RichTextBoxLogs.Text = "Not Initialized"
           Exit Sub
       End If

       retcode = ModWinsCard.SCardListReaderGroups(hContext, sReaderGroup, ReaderGroup)
       If retcode <> ModWinsCard.SCARD_S_SUCCESS Then
           'DisplayOut(GetScardErrMsg(retcode))
           RichTextBoxLogs.Clear()
           RichTextBoxLogs.Text = "List not found"
           Exit Sub
       End If


       'List PCSC card readers installed
       retcode = ModWinsCard.SCardListReaders(hContext, sReaderGroup, sReaderList, ReaderCount)
       If retcode <> ModWinsCard.SCARD_S_SUCCESS Then
           'DisplayOut(GetScardErrMsg(retcode))
           RichTextBoxLogs.Clear()
           RichTextBoxLogs.Text = "Card not installed"
           Exit Sub
       End If

       RichTextBoxLogs.Text = "Hello Connecting"



       ' Connect to the reader using hContext handle and obtain hCard handle
       retcode = ModWinsCard.SCardConnect(hContext, cmbReaderPort.Text, 1, 0 Or 1, hCard, Aprotocol)

       If (retcode <> ModWinsCard.SCARD_S_SUCCESS) Then
           MessageBox.Show("Connection Error")
       Else

           MessageBox.Show("Connection OK")

       End If


I mean what are broad steps involved like : creating Handle , Opening Session, I did start with detecting the device attached to the system. Any help will be highly appreciable.

Thanks in advance
Posted
Updated 2-Jun-14 8:38am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900