function ReadCard( var card_sn:string ; var ye:string ; var cardth:string) : integer;stdcall;
var
icdev:longint;
st:integer;
status:integer;
password:array[0..6]of char;
password1:array[0..6]of char;
sn: array[0..7]of char;begintry
icdev:=ic_init(0,9600);
if icdev<=0 then
result := -1;//status:=0;
st:=get_status(icdev,@status); //检测读写器中是否有卡,status=1 有卡
if st<>0 then result := -1;if ( status = 0 ) then
begin
ic_exit(icdev);
//windows.MessageBox(HWND(nil),'读卡器中没有卡!','系统提示',MB_OK);
result := -1;end;
st:=chk_4442(icdev); //检测是否4442卡
if st<>0 then
begin
ic_exit(icdev);
//windows.MessageBox(HWND(nil),'插入的卡不是4442卡','系统提示',MB_OK);
result := -1;
end;
password := '198288' ;
st:=asc_hex(password,password1,3);
password1 := '313938';
st:=csc_4442(icdev,3,password1);
if st<>0 then
begin
ic_exit(icdev);
// windows.MessageBox(HWND(nil),'比较密码出错!','系统提示',MB_OK);
result := -1;
end;st:=rsc_4442(icdev,3,password); //读密码
if st<>0 then
begin
ic_exit(icdev);
//windows.MessageBox(HWND(nil),'读密码出错!','系统提示',MB_OK);
result := -1;
end;//读卡号
st:=srd_4442(icdev,40,8,sn);
//st := srd_4442(icdev,40,8,card_sn);
if st<>0 then
begin
ic_exit(icdev);
//windows.MessageBox(HWND(nil),'读卡出错!','系统提示',MB_OK);
result := -1;
end;
//CopyMemorY(@card_sn,pchar(sn),sizeof(sn));
//FillMemory(@card_sn,sizeof(sn),sn);
//windows.MessageBox(HWND(nil) , pchar(card_sn) , sn , MB_OK );
card_sn := sn ;
//freemem(sn^);
//card_sn := strcopy(
//card_sn := sn;
//card_sn := '12345678';//windows.MessageBox(HWND(nil) , pchar(card_sn) , sn , MB_OK );
//card_sn := pchar(card_sn);ic_exit(icdev) ;
ye := '0000.00';
cardth := '01';
result := 1;
except
result := -1; //经过跟踪执行到END 之 后才会提示无效的指针操作
end;
end;出错原文 (CDTEST.exe 是我的调用以上动态库的可执行文件)
Porject CDTEST.exe raised exception class EInvalidPointer with message 'Invalid pointer operation '. Porcess stopped. Use Step or Run to continue.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货