delphi 国腾GTICR100 二代身份证的读取
来源:互联网 发布:怎么判断usb2.0端口 编辑:程序博客网 时间:2024/04/27 23:42
================================以下是DLL定义文件==============================
unit Comm_GoldTel_Dll;
///////国腾GTICR100
interface
uses Controls,sysutils,Quickrpt,QDialogs,Classes;
const NameLen = 30;
const SexLen = 5;
const NationLen = 10;
const DateLen = 8;
const AddrLen = 70;
const IdLen = 18;
const DepartmentLen = 30;
const ReserveLen = 36;
type
TPeopleBaseInfo = record
PeoName: array [0..NameLen] of char;
PeoSex: array [0..SexLen] of char;
PeoFolk: array [0..NationLen] of char;
PeoBirthday: array [0..DateLen] of char;
PeoAddress: array [0..AddrLen] of char;
PeoIDNumber: array [0..IdLen] of char;
PeoDepartment: array [0..DepartmentLen] of char;
PeoStartDate: array [0..DateLen] of char;
PeoEndDate: array [0..DateLen] of char;
PeoReserve: array [0..ReserveLen] of char;
paddaddress1: array [0..AddrLen] of char;
m_szphoto: array [0..1023] of char;
end;
TPsnMsg = record
PeoName: string;
PeoSex: string;
PeoFolk: string;
PeoBirthday: string;
PeoAddress: string;
PeoIDNumber: string;
PeoDepartment: string;
PeoStartDate: string;
PeoEndDate: string;
PeoReserve: string;
paddaddress1: string;
m_szphoto: array [0..1023] of char;
end;
function GetBmp(Wlt_File: pchar; intf: integer): integer; stdcall;external 'WltRS.dll';
function InitComm(iPort: Integer):integer;stdcall;external 'termb.dll';
function Authenticate():integer;stdcall;external 'termb.dll';
function Read_Content(iActive : integer):integer;stdcall;external 'termb.dll';
function CloseComm():integer;stdcall;external 'termb.dll';
function GetPeopleName(szName:pchar;iLen:integer):integer;stdcall;external 'termb.dll';
function GetPeopleSex(szSex:pchar;iLen:integer):integer;stdcall;external 'termb.dll';
function GetPeopleNation(szNation:pchar;iLen:integer):integer;stdcall;external 'termb.dll';
function GetPeopleBirthday(szBirthday:pchar;iLen:integer):integer;stdcall;external 'termb.dll';
function GetPeopleAddress(szAddress:pchar;iLen:integer):integer;stdcall;external 'termb.dll';
function GetPeopleIDCode(szID:pchar;iLen:integer):integer;stdcall;external 'termb.dll';
function GetDepartment(szDepartment:pchar;iLen:integer):integer;stdcall;external 'termb.dll';
function GetStartDate(szStartDate:pchar;iLen:integer):integer;stdcall;external 'termb.dll';
function GetEndDate(szEndDate:pchar;iLen:integer):integer;stdcall;external 'termb.dll';
function GetPort:integer;
FUNCTION GetPersonalMsg(Port:integer):TPsnMsg;
var
m_szDllPath : string;
// PsnMsg:TPeopleBaseInfo;
PsnMsg:TPsnMsg;
IDCard_Port:integer = 0;
implementation
function GetPort:integer;
var
i,iRet:integer;
begin
IDCard_Port:=0;
i:=1;
while i<=6 do begin
iRet := InitComm(i);
if iRet = 1 then
begin
// ShowMessage('打开COM--> '+inttostr(i));
IDCard_Port:=i;
Result:=i;
break;
end;
i:=i+1;
end;
if iRet <> 1 then begin
i:=1001;
while i<=1006 do begin
iRet := InitComm(i);
if iRet = 1 then begin
// ShowMessage('打开USB-->'+inttostr(i));
IDCard_Port:=i;
Result:=i;
break;
end;
i:=i+1;
end;
end;
end;
function GetPersonalMsg(Port:integer):TPsnMsg;
var
iRet : integer;
szName:Array[0..NameLen] of char;
szSex:Array[0..SexLen] of char;
szNation:Array[0..NationLen] of char;
szBirthday:Array[0..DateLen] of char;
szAddress:Array[0..AddrLen] of char;
szID:Array[0..IdLen] of char;
szDepartment:Array[0..DepartmentLen] of char;
szStartDate:Array[0..DateLen] of char;
szEndDate:Array[0..DateLen] of char;
begin
// Image1.Picture.Assign(nil);
FillChar(szName,sizeof(szName),0);
if IDCard_Port < 1 then
begin
ShowMessage('打开串口失败!');
exit;
end;
iRet := InitComm(IDCard_Port);
if iRet <> 1 then
begin
ShowMessage('打开串口失败!');
exit;
end;
Authenticate();
iRet := Read_Content(1);
if iRet <> 1 then
begin
ShowMessage('读卡失败!');
CloseComm();
exit;
end;
iRet := GetPeopleName(szName,sizeof(szName));
iRet := GetPeopleSex(szSex,sizeof(szSex));
iRet := GetPeopleNation(szNation,sizeof(szNation));
iRet := GetPeopleBirthday(szBirthday,sizeof(szBirthday));
iRet := GetPeopleAddress(szAddress,sizeof(szAddress));
iRet := GetPeopleIDCode(szID,sizeof(szID));
iRet := GetDepartment(szDepartment,sizeof(szDepartment));
iRet := GetStartDate(szStartDate,sizeof(szStartDate));
iRet := GetEndDate(szEndDate,sizeof(szEndDate));
CloseComm();
if iRet = 0 then
begin
ShowMessage('获取卡信息失败!');
exit;
end;
PsnMsg.PeoName := szName;
PsnMsg.PeoSex := szSex;
PsnMsg.PeoBirthday := szBirthday;
PsnMsg.PeoIDNumber := szID;
PsnMsg.PeoDepartment := szDepartment;
PsnMsg.PeoStartDate := szStartDate;
PsnMsg.PeoFolk := szNation;
PsnMsg.PeoAddress := szAddress;
PsnMsg.PeoEndDate := szEndDate;
Result := PsnMsg;
end;
end.
=======================================对函数的调用===========================
步骤1:
调用获得
_Port := inttostr(GetPort); //初始化读卡器,并且获得端口号.
步骤2:
procedure TPsnFrm.BtnReadCardClick(Sender: TObject);
var
_PsnMsg:TPsnMsg;
begin
inherited;
if IDCard_Port >= 1 then begin
_PsnMsg:=GetPersonalMsg(IDCard_Port);
T1NAME.AsString:=_PsnMsg.PeoName;
T1CSNY.AsString:=copy(_PsnMsg.PeoBirthday,1,4)+'-'+copy(_PsnMsg.PeoBirthday,5,2)+'-'+copy(_PsnMsg.PeoBirthday,7,2);
T1IDNO.AsString:=_PsnMsg.PeoIDNumber;
T1NATION.AsString:=_PsnMsg.PeoFolk;
T1ADDRESS.AsString:=_PsnMsg.PeoAddress;
if _PsnMsg.PeoSex = '男' then begin
T1SEXS.AsString:='1';
end
else begin
T1SEXS.AsString:='0';
end;
end;
end;
- delphi 国腾GTICR100 二代身份证的读取
- delphi 二代身份证阅读器 SDT_ReadBaseMsg()读取到的照片数据进行处理问题
- C#读取二代身份证
- C#读取二代身份证
- .net读取二代身份证
- 读取二代身份证
- 二代身份证读取操作类
- asp.net读取二代身份证
- delphi 二代身份证阅读器开发 SDT_ReadBaseMsg函数
- 二代身份证读卡器接口函数Delphi声明
- 二代身份证的尺寸大小
- 二代身份证读卡器的二次开发
- 二代身份证上的信息
- C# 国腾 二代身份证 扫描身份证信息
- 读取二代身份证上的相片,函数GetBmp(char * Wlt_File,int intf) 怎么用?
- 可爱的二代身份证终于到手了"
- 也看二代身份证的安全问题
- 黑莓9900能否读取二代身份证啊? (求证中)
- 水浒传108将之死
- 网传腾讯大规模裁员测试工程师,腾讯相关人员否认
- Cypher查询语言--Neo4j中的SQL(6)
- mysql语句中用if的例子_数据库技巧
- 利用Android的Log 演示一个activity的生命周期
- delphi 国腾GTICR100 二代身份证的读取
- jquery中event object
- Oracle 10g的闪回恢复区
- WC 2005 dface 双面棋盘
- Delphi的dll如何向C#传出string(1)
- 有用的网
- oracle 11g linux 建立表空间 用户 授权 数据库导入导出
- gtk入门教程 LINUX
- 好用的Java反编译工具同时提供eclipse插件安装