J
jxdxlzx
Unregistered / Unconfirmed
GUEST, unregistred user!
var
Form1: TForm1;
function OpenPort(PortName:string;PortHandle:ip):integer;stdcall;external 'micro900.dll';
function ClosePort():integer;stdcall;external 'micro900.dll';
function SelectPort(PortHandle:integer):integer;stdcall;external 'micro900.dll';
function PowerOn():integer;stdcall;external 'micro900.dll';
function PowerOff():integer;stdcall;external 'micro900.dll';
function CardPresent():integer;stdcall;external 'micro900.dll';
function CardChanged():integer;stdcall;external 'micro900.dll';
function GetCardType(ATRBuffer:string):integer;stdcall;external 'micro900.dll';
function GetCardName(CardType:integer)char;stdcall;external 'micro900.dll';
function Read_4428_With_PB(StrartPos:integer;NOB:integer;Bfrchar;PB_Bfrchar):Integer;stdcall;external 'micro900.dll';
function Read_4442_With_PB(StrartPos:integer;NOB:integer;Bfrchar;PB_Bfrchar):Integer;stdcall;external 'micro900.dll';
function Write_4442_PB(StrartPos:integer):Integer;stdcall;external 'micro900.dll';
function Write_4442(StrartPos:integer;DestByte:char;PBSetFlag:char):Integer;stdcall;external 'micro900.dll';
function Write_4442_Array(StrartPos:integer;NOB:integer;Bfrchar;PB_Bfrchar):Integer;stdcall;external 'micro900.dll';
function Verify_4442_PSC(PSC1:Char;PSC2:char;PSC3:char):Integer;stdcall;external 'micro900.dll';
function Read_4442_SM(SM_Bfrchar):Integer;stdcall;external 'micro900.dll';
function Write_4442_SM(SMAddress:integer;SMByte:char):Integer;stdcall;external 'micro900.dll';
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
result,aa,bb:integer;
porth:ip;
ATRchar;
cc:string;
gg:string;
StrartPos:integer;
NOB:integer;
Bfr:array[0..1024] of char;
PB_Bfr:array[0..1024] of char;
begin
aa:=0;
porth:=@aa;
result:=OpenPort('COM1',Porth);
bb:=porth^;
cc:=inttostr(bb);
edit1.Text:=cc;
result:=CardPresent();
if result<>1 then
showmessage('没有插入IC卡')
else
begin
edit1.Text:='有IC卡';
if CardChanged()<>1 then
showmessage('没换IC卡')
else
edit2.Text:='新IC卡';
result:=GetCardType(ATR); ////////可能错在此处,在DELPHI环境下编译运行可以返回正确的值,独立运行时不能返回正确的值.未安装DELPHI的机子上运行可以得出正确结果,安装了DELPHI后就不能独立运行得出正确结果..呜呜呜.....///
edit3.Text:=atr^;
edit4.Text:=inttostr(result);
if result>0 then
begin
gg:=GetCardName(result);
edit5.Text:=gg;
if result=4 then
begin
StrartPos:=0;
NOB:=1024;
gg:='1111';
result:=Read_4428_With_PB(StrartPos,NOB,Bfr,PB_Bfr);
gg:=bfr;
edit3.Text:=inttohex(strtoint(inttostr(ord(bfr[17]))),2)+' '+ inttohex(strtoint(inttostr(ord(bfr[18]))),2)+' '+ inttohex(strtoint(inttostr(ord(bfr[19]))),2);
edit6.Text:='line'+#100#101#102;
edit7.Text:='hex'+chr(strtoint('$65'))+chr(strtoint('$66'));
end;
end;
end;
end;
Form1: TForm1;
function OpenPort(PortName:string;PortHandle:ip):integer;stdcall;external 'micro900.dll';
function ClosePort():integer;stdcall;external 'micro900.dll';
function SelectPort(PortHandle:integer):integer;stdcall;external 'micro900.dll';
function PowerOn():integer;stdcall;external 'micro900.dll';
function PowerOff():integer;stdcall;external 'micro900.dll';
function CardPresent():integer;stdcall;external 'micro900.dll';
function CardChanged():integer;stdcall;external 'micro900.dll';
function GetCardType(ATRBuffer:string):integer;stdcall;external 'micro900.dll';
function GetCardName(CardType:integer)char;stdcall;external 'micro900.dll';
function Read_4428_With_PB(StrartPos:integer;NOB:integer;Bfrchar;PB_Bfrchar):Integer;stdcall;external 'micro900.dll';
function Read_4442_With_PB(StrartPos:integer;NOB:integer;Bfrchar;PB_Bfrchar):Integer;stdcall;external 'micro900.dll';
function Write_4442_PB(StrartPos:integer):Integer;stdcall;external 'micro900.dll';
function Write_4442(StrartPos:integer;DestByte:char;PBSetFlag:char):Integer;stdcall;external 'micro900.dll';
function Write_4442_Array(StrartPos:integer;NOB:integer;Bfrchar;PB_Bfrchar):Integer;stdcall;external 'micro900.dll';
function Verify_4442_PSC(PSC1:Char;PSC2:char;PSC3:char):Integer;stdcall;external 'micro900.dll';
function Read_4442_SM(SM_Bfrchar):Integer;stdcall;external 'micro900.dll';
function Write_4442_SM(SMAddress:integer;SMByte:char):Integer;stdcall;external 'micro900.dll';
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
result,aa,bb:integer;
porth:ip;
ATRchar;
cc:string;
gg:string;
StrartPos:integer;
NOB:integer;
Bfr:array[0..1024] of char;
PB_Bfr:array[0..1024] of char;
begin
aa:=0;
porth:=@aa;
result:=OpenPort('COM1',Porth);
bb:=porth^;
cc:=inttostr(bb);
edit1.Text:=cc;
result:=CardPresent();
if result<>1 then
showmessage('没有插入IC卡')
else
begin
edit1.Text:='有IC卡';
if CardChanged()<>1 then
showmessage('没换IC卡')
else
edit2.Text:='新IC卡';
result:=GetCardType(ATR); ////////可能错在此处,在DELPHI环境下编译运行可以返回正确的值,独立运行时不能返回正确的值.未安装DELPHI的机子上运行可以得出正确结果,安装了DELPHI后就不能独立运行得出正确结果..呜呜呜.....///
edit3.Text:=atr^;
edit4.Text:=inttostr(result);
if result>0 then
begin
gg:=GetCardName(result);
edit5.Text:=gg;
if result=4 then
begin
StrartPos:=0;
NOB:=1024;
gg:='1111';
result:=Read_4428_With_PB(StrartPos,NOB,Bfr,PB_Bfr);
gg:=bfr;
edit3.Text:=inttohex(strtoint(inttostr(ord(bfr[17]))),2)+' '+ inttohex(strtoint(inttostr(ord(bfr[18]))),2)+' '+ inttohex(strtoint(inttostr(ord(bfr[19]))),2);
edit6.Text:='line'+#100#101#102;
edit7.Text:='hex'+chr(strtoint('$65'))+chr(strtoint('$66'));
end;
end;
end;
end;