'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
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)