📄 unit13.pas
字号:
unit Unit13;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TForm13 = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
Panel1: TPanel;
Button1: TButton;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form13: TForm13;
fpimage:array[1..240*240] of byte;
fptemplate:array[1..3,1..256]of byte;
fp1_count,fp2_count,fp3_count:integer;
fp_user_id:string;
implementation
function DFZ2003U_InitButton(hwnd1:HWND):integer;stdcall;
external 'Dfz2003u.dll';
procedure DFZ2003U_CloseButton;stdcall;
external 'Dfz2003u.dll';
function DFZ2003U_ReadFpImage(pImage:PChar;dwBufferSize:DWORD):integer;stdcall;
external 'Dfz2003u.dll';
function DFPOptDrawImage(h:HWND;Img:PChar;flag:integer):longint;stdcall;
external 'DFPSDKOpt.dll';
function DFPOptGetFeature(Img:PChar;ExternalFeature:PChar):integer;stdcall;
external 'DFPSDKOpt.dll';
function DFPOptMatchFinger( f1:Pchar;f2:PChar;SecurityLevel:integer):integer;stdcall;
external 'DFPSDKOpt.dll';
{$R *.dfm}
procedure TForm13.FormShow(Sender: TObject);
begin
// if DFZ2003U_InitButton(Handle)<> 1 then showmessage('指纹仪初始化失败');
DFZ2003U_InitButton(Handle);
end;
procedure TForm13.FormClose(Sender: TObject; var Action: TCloseAction);
begin
DFZ2003U_CloseButton;
end;
procedure TForm13.BitBtn3Click(Sender: TObject);
var
hex_fp1,hex_fp2:string;
i:integer;
begin
// if DFZ2003U_InitButton(Handle)= 1 then showmessage('指纹仪初始化成功');
hex_fp1:='0x';
hex_fp2:='0x';
for i:=1 to 256 do begin
hex_fp1:=hex_fp1+IntToHex(fptemplate[1][i],2);
hex_fp2:=hex_fp2+IntToHex(fptemplate[2][i],2);
end;
{ with form1.sql_query do begin
close;
sql.Clear;
sql.Add('update userid set fp1_count='+inttostr(fp1_count)+', fp1 ='+hex_fp1+', fp2_count='+inttostr(fp2_count)+', fp2 ='+hex_fp2+' where user_id='+''''+fp_user_id+'''');
try
execsql;
showmessage('成功 保存');
except
end;
close;
end; }
end;
procedure TForm13.BitBtn1Click(Sender: TObject);
begin
showmessage('请按好手指后,按确定键');
if DFZ2003U_ReadFpImage(@fpimage,240*240)=1 then begin;
DFPOptDrawImage(panel1.Handle,@fpimage,2);
fp1_count:=DFPOptGetFeature(@fpimage,@fptemplate[1]);
if fp1_count>10 then begin
showmessage('登记成功!');
end else begin
showmessage('指纹图象不符合要求,请重新登记!');
end;
end else begin
showmessage('指纹图象采集不到,请重试!');
end;
end;
procedure TForm13.BitBtn2Click(Sender: TObject);
begin
showmessage('请按好手指后,按确定键');
if DFZ2003U_ReadFpImage(@fpimage,240*240)=1 then begin;
DFPOptDrawImage(panel1.Handle,@fpimage,2);
fp2_count:=DFPOptGetFeature(@fpimage,@fptemplate[2]);
if fp2_count>10 then begin
showmessage('登记成功!');
end else begin
showmessage('指纹图象不符合要求,请重新登记!');
end;
end else begin
showmessage('指纹图象采集不到,请重试!');
end;
end;
procedure TForm13.BitBtn4Click(Sender: TObject);
begin
// if DFPOptMatchFinger( @fptemplate[1],@fptemplate[2],4)=1 then showmessage('比对成功') else showmessage('比对失败');
close;
end;
procedure TForm13.Button1Click(Sender: TObject);
begin
showmessage('请按好手指后,按确定键');
if DFZ2003U_ReadFpImage(@fpimage,240*240)=1 then begin
DFPOptDrawImage(panel1.Handle,@fpimage,2);
fp3_count:=DFPOptGetFeature(@fpimage,@fptemplate[3]);
if DFPOptMatchFinger( @fptemplate[3],@fptemplate[1],2)=1 then begin
showmessage('比对成功!');
end else begin
if DFPOptMatchFinger( @fptemplate[3],@fptemplate[2],2)=1 then begin
showmessage('比对成功!');
end else begin
showmessage('比对失败!');
end;
end;
end else begin
showmessage('指纹图象采集不到,请重试!');
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -