sample6.dpr
来自「用来测试任何pcsc兼容读卡器」· DPR 代码 · 共 69 行
DPR
69 行
{$APPTYPE CONSOLE}
program sample6;
uses Windows,PCSCClasses,SysUtils,VASBase,SelectReader2;
var
rm:TResourceManager;
readername:string;
begin
try
readername:=ShowSelectReader('');
if readername<>'' then
begin
rm:=TResourceManager.Create(nil);
if Assigned(rm) then
with rm do
try
scope:=dsSystem;
if Assigned(Readers[readername]) then
with Readers[readername] do
begin
if not CardPresent then
Writeln('Insert a card into the reader...');
if WaitForCardInsertion(INFINITE) then
if Atr.Length<>0 then
begin
Connect(smExclusive,prDefault);
Writeln('Connected');
///////////////////////////////////////////////
// The really important part of the example
/////////////////////////////
try
SendBuffer.hex:='00 01 02 03 04';
ReceiveBuffer.Capacity:=20;
Transmit;
Writeln('Data sent:'+sendbuffer.hex);
Writeln('Data received:'+receivebuffer.hex);
except
on E:Exception do Writeln(e.Message);
end;
try
SendBuffer.hex:='A0,A4,0,0 2,3F,00';
ReceiveBuffer.Capacity:=128;
Transmit;
Writeln('Data sent:'+sendbuffer.hex);
Writeln('Data received:'+receivebuffer.hex);
except
on E:Exception do Writeln(e.Message);
end;
////////////////////////////////////////////////
end
else
Writeln('Card wrongly inserted or not responding!');
end
else
writeln('There has been a problem with accessing the reader');
writeln('Press any key to finish...');
readln;
finally
rm.Free;
end;
end;
except
on e:ESCardError do
begin
writeln(e.message);
readln;
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?