📄 sample6.dpr
字号:
{$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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -