線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:3702
推到 Plurk!
推到 Facebook!

取得PCSC讀卡機清單

 
juitsung
一般會員


發表:4
回覆:2
積分:1
註冊:2003-03-31

發送簡訊給我
#1 引用回覆 回覆 發表時間:2010-07-21 17:03:08 IP:114.44.xxx.xxx 訂閱
//---------------------------------------------------------------------------
bool __fastcall GetReaderList()
{
unsigned long pcchReaders = 0;
TStringList *readers;
if(ret != SCARD_S_SUCCESS)
String msg = "Failed SCardEstablishContext! " GetErrorCodeDescription(ret);
return false;
ret = SCardListReaders(_ContextHandle, NULL, NULL, &pcchReaders);
// 有錯誤
Application->NormalizeTopMosts();
#ifdef _DELPHI_STRING_UNICODE
Application->MessageBox(msg.w_str(),
Application->MessageBox(
"WARRING", MB_OKCANCEL);
#endif
return false;
// 取得讀卡機資訊的字串長度
if (ret != SCARD_S_SUCCESS)
String msg = GetErrorCodeDescription(ret);
return false;
try
TStringList *readers = new TStringList();
// 取得系統讀卡機資訊的字串
if (ret == SCARD_S_SUCCESS)
LPTSTR readerName = mszReaders;
// 拆解字串
{
readerNumber ;
}
return true;
}
{
free(mszReaders);
}
AnsiString sErrString;
return sErrString;
}
//---------------------------------------------------------------------------
String __fastcall GetErrorCodeDescription(int nErrCode)
{
String sErrString;
if(sErrCode == "80100001")
else if(sErrCode == "0x80100002")
else if(sErrCode == "0x80100003")
sErrString = "Invalid Handle";
sErrString = "Invalid Parameter";
sErrString = "Invalid Target";
else if(sErrCode == "0x80100007")
else if(sErrCode == "0x80100008")
sErrString = "Insufficient Buffer";
else if(sErrCode == "0x8010000A")
else if(sErrCode == "0x8010000B")
else if(sErrCode == "0x8010000C")
else if(sErrCode == "0x8010000D")
sErrString = "Unknown Card";
sErrString = "Can't Dispose";
else if(sErrCode == "0x80100010")
sErrString = "Not Ready";
sErrString = "Invalid Value";
sErrString = "System Cancelled";
sErrString = "Comm Error";
sErrString = "Unknown Error";
sErrString = "Invalid ATR";
sErrString = "Not Transacted";
sErrString = "Reader Unavailable";
sErrString = "Shutdown";
sErrString = "PCI Too Small";
sErrString = "Reader Unsupported";
sErrString = "Duplicate Reader";
sErrString = "Card Unsupported";
sErrString = "No Service";
sErrString = "Service Stopped";
sErrString = "Unsupported Card";
sErrString = "Unresponsive Card";
sErrString = "Unpowered Card";
sErrString = "Reset Card";
sErrString = "Removed Card";
sErrString = "Unknown PC/SC Error Code - No Further Information Is Available.";
return sErrString;
}
編輯記錄
juitsung 重新編輯於 2010-07-21 17:04:28, 註解 無‧
juitsung 重新編輯於 2010-07-21 17:04:45, 註解 無‧
juitsung 重新編輯於 2010-07-21 17:06:10, 註解 無‧
juitsung 重新編輯於 2010-07-21 17:08:02, 註解 無‧
juitsung 重新編輯於 2010-07-21 17:15:55, 註解 無‧
系統時間:2024-11-21 20:13:15
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!