代码:Global Const $SCARD_SCOPE_USER = 0
Dim $hContext
Dim $pcchReaders = 500
Dim $szReaderList
$dll = DllOpen("WinScard.dll")
if @error Then MsgBox(0,"1","Fail Load")
$result = DllCall($dll, "long", "SCardEstablishContext","long",$SCARD_SCOPE_USER,"long",0,"long",0,"long*",$hContext)
$hContext = $result[4];
if @error Then
MsgBox(0,"2","Fail" & @error & $hContext & $result)
DllClose($dll)
Exit
EndIf
$result = DllCall($dll, "lparam", "SCardListReaders","long",$hContext,"str","","STR",$szReaderList,"long*",$pcchReaders)
if @error Then
MsgBox(0,"3","Fail" & $pcchReaders & $result)
DllClose($dll)
Exit
EndIf
MsgBox(0,"", $result[3])
DllClose($dll)
问题描述:
在调用SCardListReaders时,第三个参数用于返回智能卡名字的字符串,但因为存在多个智能卡,所以这个字符串中包含了结束符。
直接使用返回的字符串,即$result[3],只能显示第一个智能卡名字,后面的名字被字符串自动截掉了。
请教 :这种情况下,如何把各智能卡名字分别存储在不同的string里面 |