公司给出的接口说明
读二代身份证
原型: int ReadCard(char *Name,
char *Sex,
char *Nation,
char *Birthday,
char *Address,
char *ID,
char *Department,
char *StartDate,
char *EndDate,
char *Reserve,
char *AppAddress1,
char *PhotoData)
参数: Name 姓名
Sex 性别
Nation 民族
Birthday 生日
Address 住址
ID 身份证号
Department 发证机关
StartDate 起始日期
EndDate 终止日期
Reserve 预留信息
AppAddress1 预留地址
PhotoData 照片信息
返回:
=0 成功
<0 失败
程序如下
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
OpenCom = function (Comport:integer;Baud:integer):integer;stdcall;
SelModule = function (PortType:integer;Module:integer):integer;stdcall;
CloseCom = function ():integer;stdcall;
ReadCard = function (Name:pChar;Sex:pChar;Nation:pChar;Birthday:pChar;
Address:pChar;ID:pChar;Department:pChar;StartDate:pChar;EndDate:pChar;
Reserve:pChar;AppAddress1:pChar;PhotoData:pChar):integer;stdcall;
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var DllHandle:THandle;
ComPort,Baud,HBaud,result:integer;
PortType,Module:integer;
sfzName,sfzSex,sfzNation,sfzBirthday,sfzAddress,sfzID,sfzDepartment,
sfzStartDate,sfzEndDate,sfzReserve,sfzAppAddress1,sfzPhotoData:string;
oc:OpenCom;
sm:SelModule;
cc:CloseCom;
rc:ReadCard;
begin ComPort:=1;Baud:=9600;HBaud:=115200;result:=22;
PortType:=0;Module:=3; DLLHandle:=LoadLibrary('JCJP_API.dll');
if DLLHandle<>0 then
begin
@oc:=GetProcAddress(DllHandle,'Open_Com'); if @oc<>nil then
begin
if( oc(ComPort,Baud) = 0 )then
begin
@sm:= GetProcAddress(DllHandle,'Sel_Module');
if @sm<>nil then
begin
if(sm(PortType,Module) = 0)then
begin
@cc:= GetProcAddress(DllHandle,'Close_Com');
if( cc()=0)then
begin
@oc:=GetProcAddress(DllHandle,'Open_Com');
if(@oc<>nil)then
begin
if(oc(ComPort,HBaud)=0)then
begin
@rc:= GetProcAddress(DllHandle,'ReadCard');
if @rc<>nil then
begin
try
if(rc(@sfzName,@sfzSex,@sfzNation,@sfzBirthday,@sfzAddress,@sfzID,@sfzDepartment,
@sfzStartDate,@sfzEndDate,@sfzReserve,@sfzAppAddress1,@sfzPhotoData)=0)then
begin
// showmessage(sfzID);
showmessage('222'+sfzName);
showmessage('222');
end
else
begin
showmessage('没有找到二代身份证,读取失败!');
end;
except
on E:exception do
showmessage(e.Message);
end;
result:=sm(PortType,0);
result:=cc();
end
else
showmessage('rc is nil');
end
else
showmessage('高频打开串口失败');
end
else
showmessage('oc is nil');
end
else
showmessage('关闭串口失败');
end
else
begin
showmessage('选择模式失败');
end;
end
else
begin
showmessage('sm is nil');
end;
end
else
showmessage('串口打开失败!');
end
else
showmessage('oc is nil');
end
else
showmessage('222');
FreeLibrary(DLLHandle);
end;procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
end.-----------------------------------------
把下面这句删掉一切正常。
rc( sfzName,@sfzSex,@sfzNation,@sfzBirthday,@sfzAddress,
@sfzID,@sfzDepartment,@sfzStartDate,@sfzEndDate,@sfzReserve,
@sfzAppAddress1,@sfzPhotoData)=0
请高手帮忙look lookdll Windows指针
读二代身份证
原型: int ReadCard(char *Name,
char *Sex,
char *Nation,
char *Birthday,
char *Address,
char *ID,
char *Department,
char *StartDate,
char *EndDate,
char *Reserve,
char *AppAddress1,
char *PhotoData)
参数: Name 姓名
Sex 性别
Nation 民族
Birthday 生日
Address 住址
ID 身份证号
Department 发证机关
StartDate 起始日期
EndDate 终止日期
Reserve 预留信息
AppAddress1 预留地址
PhotoData 照片信息
返回:
=0 成功
<0 失败
程序如下
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
OpenCom = function (Comport:integer;Baud:integer):integer;stdcall;
SelModule = function (PortType:integer;Module:integer):integer;stdcall;
CloseCom = function ():integer;stdcall;
ReadCard = function (Name:pChar;Sex:pChar;Nation:pChar;Birthday:pChar;
Address:pChar;ID:pChar;Department:pChar;StartDate:pChar;EndDate:pChar;
Reserve:pChar;AppAddress1:pChar;PhotoData:pChar):integer;stdcall;
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var DllHandle:THandle;
ComPort,Baud,HBaud,result:integer;
PortType,Module:integer;
sfzName,sfzSex,sfzNation,sfzBirthday,sfzAddress,sfzID,sfzDepartment,
sfzStartDate,sfzEndDate,sfzReserve,sfzAppAddress1,sfzPhotoData:string;
oc:OpenCom;
sm:SelModule;
cc:CloseCom;
rc:ReadCard;
begin ComPort:=1;Baud:=9600;HBaud:=115200;result:=22;
PortType:=0;Module:=3; DLLHandle:=LoadLibrary('JCJP_API.dll');
if DLLHandle<>0 then
begin
@oc:=GetProcAddress(DllHandle,'Open_Com'); if @oc<>nil then
begin
if( oc(ComPort,Baud) = 0 )then
begin
@sm:= GetProcAddress(DllHandle,'Sel_Module');
if @sm<>nil then
begin
if(sm(PortType,Module) = 0)then
begin
@cc:= GetProcAddress(DllHandle,'Close_Com');
if( cc()=0)then
begin
@oc:=GetProcAddress(DllHandle,'Open_Com');
if(@oc<>nil)then
begin
if(oc(ComPort,HBaud)=0)then
begin
@rc:= GetProcAddress(DllHandle,'ReadCard');
if @rc<>nil then
begin
try
if(rc(@sfzName,@sfzSex,@sfzNation,@sfzBirthday,@sfzAddress,@sfzID,@sfzDepartment,
@sfzStartDate,@sfzEndDate,@sfzReserve,@sfzAppAddress1,@sfzPhotoData)=0)then
begin
// showmessage(sfzID);
showmessage('222'+sfzName);
showmessage('222');
end
else
begin
showmessage('没有找到二代身份证,读取失败!');
end;
except
on E:exception do
showmessage(e.Message);
end;
result:=sm(PortType,0);
result:=cc();
end
else
showmessage('rc is nil');
end
else
showmessage('高频打开串口失败');
end
else
showmessage('oc is nil');
end
else
showmessage('关闭串口失败');
end
else
begin
showmessage('选择模式失败');
end;
end
else
begin
showmessage('sm is nil');
end;
end
else
showmessage('串口打开失败!');
end
else
showmessage('oc is nil');
end
else
showmessage('222');
FreeLibrary(DLLHandle);
end;procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
end.-----------------------------------------
把下面这句删掉一切正常。
rc( sfzName,@sfzSex,@sfzNation,@sfzBirthday,@sfzAddress,
@sfzID,@sfzDepartment,@sfzStartDate,@sfzEndDate,@sfzReserve,
@sfzAppAddress1,@sfzPhotoData)=0
请高手帮忙look lookdll Windows指针
解决方案 »
- 怎样将db数据表导入到sql2000中
- 如何让程序占用空间达到最小(如果可以的话能把方法都列出来吗?)
- 急啊!怎么取得一个整形数组里面三个最大的数?
- 关于mssql自增主键的处理,读过李维的"高效数据库"后,使用clientdataset做为数据操做的控件
- 全国都能整倭人的办法:
- 请问下面的程序错在什么地方
- 通过Image.Picture.Bitmap.Assign(MyJpeg)播放图象,怎样才能不出现闪烁?
- 一个很奇怪的问题,不知道大家有没有碰到过
- 如何用自定义的tmytreenode形成treeview?
- 怎样保存treeview的树结构?
- 不知道能不能实现.300分
- 请问大侠,在delphi中如何实现动态折线的绘制(急!!!!等着交活呢!)
按照上面提示修改。现在提示
Project Project1.exe raised exception class EaccessViolation with message 'Access violation at address 1000511B in module 'JCJP_AP'.Write of address 00404311' Process stopped.Use Step or Run to continue.
我的方法function ReadBaseInfosPhoto(Name,Sex,Folk,BirthDay,ID,Address,Issue,dBegin,dEnd,Photopath:PAnsiChar):integer;stdcall;External '.\dll\sdtapi.dll';
type
TIDCardInfo=record
_Name:array[1..31] of AnsiChar;
_Sex:array[1..3] of AnsiChar;
_Folk:array[1..10] of AnsiChar;
_Birthday:array[1..9] of AnsiChar;
_Addr:array[1..71] of AnsiChar;
_ID:array[1..19] of AnsiChar;
_Issue:array[1..31] of AnsiChar;
_dBegin:array[1..9] of AnsiChar;
_dEnd:array[1..9] of AnsiChar;
private
Fport:Integer; //端口状态
Fauthenticate:Integer; //认证状态
Freadinfo:Integer; //读卡状态
end;
ReadCard.Freadinfo:=ReadBaseInfosPhoto(@ReadCard._Name,@ReadCard._Sex,@ReadCard._Folk,@ReadCard._Birthday,@ReadCard._ID,@ReadCard._Addr,@ReadCard._Issue,@ReadCard._dBegin,@ReadCard._dEnd,PAnsiChar(AnsiString(Fphotopath)));
var
sfzName,sfzSex,sfzNation,sfzBirthday,sfzAddress,sfzID,sfzDepartment,
sfzStartDate,sfzEndDate,sfzReserve,sfzAppAddress1,sfzPhotoData:pchar;这个地方:
ReadCard = function (var Name:pChar;var Sex:pChar;var Nation:pChar;var Birthday:pChar;
var Address:pChar;var ID:pChar;var Department:pChar;var StartDate:pChar;var EndDate:pChar;
var Reserve:pChar;var AppAddress1:pChar;var PhotoData:pChar):integer;stdcall;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
OpenCom = function (Comport:integer;Baud:integer):integer;stdcall;
SelModule = function (PortType:integer;Module:integer):integer;stdcall;
CloseCom = function ():integer;stdcall;
ReadCard = function (Name,Sex,Nation,Birthday,Address,ID,Department,
StartDate,EndDate,Reserve,AppAddress1,PhotoData:PAnsiChar):integer;stdcall; TIDCardInfo=record
_Name:array[1..31] of AnsiChar;
_Sex:array[1..3] of AnsiChar;
_Nation:array[1..51] of AnsiChar;
_Birthday:array[1..9] of AnsiChar;
_Address:array[1..51] of AnsiChar;
_ID:array[1..19] of AnsiChar;
_Department:array[1..51] of AnsiChar;
_StartDate:array[1..9] of AnsiChar;
_EndDate:array[1..9] of AnsiChar;
_Reserve:array[1..51] of AnsiChar;
_AppAddress1:array[1..51] of AnsiChar;
_PhotoData:array[1..51] of AnsiChar;
Freadinfo:Integer; //读卡状态
end;
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var DllHandle:THandle;
ComPort,Baud,HBaud,result:integer;
PortType,Module:integer;
oc:OpenCom;
sm:SelModule;
cc:CloseCom;
rc:ReadCard;
idci:TIDCardInfo;
begin ComPort:=1;Baud:=9600;HBaud:=115200;result:=22;
PortType:=0;Module:=3; DLLHandle:=LoadLibrary('JCJP_API.dll');
if DLLHandle<>0 then
begin
@oc:=GetProcAddress(DllHandle,'Open_Com'); if @oc<>nil then
begin
if( oc(ComPort,Baud) = 0 )then
begin
@sm:= GetProcAddress(DllHandle,'Sel_Module');
if @sm<>nil then
begin
if(sm(PortType,Module) = 0)then
begin
@cc:= GetProcAddress(DllHandle,'Close_Com');
if( cc()=0)then
begin
@oc:=GetProcAddress(DllHandle,'Open_Com');
if(@oc<>nil)then
begin
if(oc(ComPort,HBaud)=0)then
begin
@rc:= GetProcAddress(DllHandle,'ReadCard');
if @rc<>nil then
begin
idci.Freadinfo:=rc(@idci._Name,@idci._Sex,@idci._Nation,
@idci._Birthday,@idci._Address,@idci._ID,@idci._Department,
@idci._StartDate,@idci._EndDate,@idci._Reserve,@idci._AppAddress1,
@idci._PhotoData);
showmessage('没有找到二代身份证,读取失败!');
result:=sm(PortType,0);
result:=cc();
end
else
showmessage('rc is nil');
end
else
showmessage('高频打开串口失败');
end
else
showmessage('oc is nil');
end
else
showmessage('关闭串口失败');
end
else
begin
showmessage('选择模式失败');
end;
end
else
begin
showmessage('sm is nil');
end;
end
else
showmessage('串口打开失败!');
end
else
showmessage('oc is nil');
end
else
showmessage('222');
FreeLibrary(DLLHandle);
end;procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
end.
改造完毕,读取二代证结果正常。
但是运行完毕
显示不知道怎么做了?谢谢楼上的兄弟姐妹们。