delphi 国腾GTICR100 二代身份证的读取
================================以下是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 二代身份证的读取相关推荐
- 读取二代身份证号,做个记录
转自 https://www.amobbs.com/forum.php?mod=viewthread&tid=5548512&highlight=%E8%BA%AB%E4%BB%BD% ...
- 黑莓9900能否读取二代身份证啊 求证中
分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章.分享知识,造福人民,实现我们中华民族伟大复兴! 参考: ...
- 黑莓9900能否读取二代身份证啊? (求证中)
参考: 博文:二代身份证UID读取测试 博主应该是定制了自己的读卡程序. 猜测:二代身份是ISO 14443 Type B类型的NFC卡片 typeB卡的寻卡指令,类似于type a中的26指令. 0 ...
- 当心! 二代身份证可能导致身份信息泄露
引子: thinkgeek.com 这个老外的网站很不错,卖一些很有创意的电子玩意,比如下面这个17.99美金的"钱包",可以防止身份证/护照被近距离恶意读取信息,刚看到时觉得很搞 ...
- Web 身份证读取,ActiveX 网页 二代身份证读取
BS架构在网页程序中读取二代身份证身份证信息,采用ActiveX技术,开发语言为delphi,为通用控件,可以读取身份证所有信息,并且在读取成功后可以把结果返回给JS 网页端 <HTML> ...
- 二代身份证读取 中控ID180 二三代身份证阅读器 Vue版本
二代身份证读取 中控ID180 二三代身份证阅读器 Vue版本 设备 设备名称:台式身份证阅读机 产品型号:ID180 设备驱动和文档 链接:https://pan.baidu.com/s/1nAYk ...
- 读取二代身份证上的相片,函数GetBmp(char * Wlt_File,int intf) 怎么用?
今天看到很多网友对于读取二代身份证上的相片遇到了麻烦,GetBmp(char * Wlt_File,int intf) 这个函数不知道怎么用.下面是我做的小实例,仅供参考,希望能帮到大家. publi ...
- 新中新二代身份证dll调用,报尝试读取或写入受保护的内存,这通常指示其他内存已损坏 这个错 ...
新中新二代身份证dll调用问题:调用这个dll时, 到这个方法: Syn_ReadMsg(nPort, 0, ref CardMsg),就报尝试读取或写入受保护的内存.这通常指示其他内存已损坏 这个错 ...
- 二代身份证读取-微调版
说起微调其实就是对 上一篇文章 今天意外和身份证结缘 中提到的代码码放和调用一些巧妙的用法(至少小鬼觉得很有意思很巧妙). 为什么有必要在写一篇 写的理由千千万:不写的理由万万千.对于小鬼来说就是:我 ...
最新文章
- silverlight 无法发布 如何灵活配置IP
- 阅读豆丁网----基于模型的混合多目标算法的研究
- WC前的颓废——带花树
- Struts初步知识
- ubuntu安装最新的rails-4.2.0
- 如何进行多云环境中的数据管理?
- 001 Python中的变量和字符串
- Ajax的简单应用之2
- ueditor修改默认图片保存路径,ueditor根据楼盘ID保存图片路径
- MySqL数据库监听命令_Mysql数据库监听binlog
- 使用enum代替Constants
- git push出现 remote: Support for password authentication was removed on August 13, 2021.
- 2019/9/6工学结合周记
- 第二十四章 SQL函数 CEILING
- 4.File类、Lambda表达式、JAVA IO
- PSU CS Guest Lectures at CCUT(波特兰州立大学在长春工业大学的讲座课程)
- 微信麻将连接服务器失败,微乐麻将授权失败是怎么回事?微乐麻将怎么用微信登录?...
- Android之绘制动态折线图
- 人生是一个连续的过程,没什么东西能影响人的一生,怎么选择不是问题。问题是每天都要努力 (转)...
- MATLAB解线性方程组