N
Neo_leaf
Unregistered / Unconfirmed
GUEST, unregistred user!
Project->ImportTypeLibrary->Add"SBSPCOM.DLL"->Create Unit
定义变量:
uses Comobj;// Unit_UIdefined,
var
DeviceID : Smallint; //SBSPCOMLib.SecuBSP
objSecuBsp : variant; // Declaration variable for SecuBSP Object
objDevice : variant; //Store Device ID etc.
objExtraction : variant; //Store & Process FingerPrint Data
objMatching : variant;
objFPData : IFPData; //
szFIRTextData : wideString;//Store The Finger Print Data after Encode.
biFIR1,biFIR2,biFIR_First,biFIR_Second : array of byte; //Store The Finger Print Data Byte.
FirstFIR,SecondFIR : WideString; //objExtraction.TextEncodeFIR 指纹数据
arrFP : array[0..799] of byte;
调用COM:
objSecuBsp := CreateOleObject('SBSPCOM.SecuBSP');
objDevice := objSecuBSP.Device;
objExtraction := objSecuBSP.Extraction;
objMatching := objSecuBSP.Matching;
objFPData := IFPData(IUnknown(objSecuBSP.FPData));
调用取数据:
procedure TFrm_Capture.TimerFirstTimer(Sender: TObject);
var
len : Integer;
begin
try
TimerFirst.Enabled := False;
TimerSec.Enabled := False;
LblCptMsg.Caption := 'Put your finger on the sensor please!';
LblCptMsg.Refresh;
objDevice.Enumerate;
objDevice.Open(2); //
SetInitValue(PicFirst.Handle);
objExtraction.Capture(1);
Len := objExtraction.FIRLength;
biFIR1 := nil;
SetLength(biFIR1, Len); //biFIR
biFIR1 := objExtraction.FIR;
szFIRTextData := objExtraction.TextEncodeFIR;
FirstFIR := objExtraction.TextEncodeFIR;
objFPData.Export(biFIR1,2);
if objFPData.ErrorCode=0 then
begin
biFIR_First := nil;
Len := objFPData.FPDataSize[0];
SetLength(biFIR_First, len);
biFIR_First := objFPData.FPData[0,0];
end;
objDevice.Close(2);
//取完数据,关闭子窗口
Frm_Capture.Close;
except
end;
end;
//父窗口调用子窗口
procedure TFrm_Main.Button2Click(Sender: TObject);
begin
if not Assigned(Frm_Capture) then
Frm_Capture := TFrm_Capture.Create(nil);
Frm_Capture.Visible := False;
Frm_Capture.ShowModal;
sFPData2 := Frm_Capture.sFPData;//这个变量子窗口有的,
FreeAndNil(Frm_Capture);
end;
请教大家:由于某种原因,需要调用两次子窗口,在第一次调用并关闭时,一切正常(父窗口不会被关闭),
但是第二次关闭子窗口时,出现故障,父窗口被一起关闭,
并有时会出现异常错误:
Access Violation at address '十六进制数' in module 'ntdll.dll'.....
定义变量:
uses Comobj;// Unit_UIdefined,
var
DeviceID : Smallint; //SBSPCOMLib.SecuBSP
objSecuBsp : variant; // Declaration variable for SecuBSP Object
objDevice : variant; //Store Device ID etc.
objExtraction : variant; //Store & Process FingerPrint Data
objMatching : variant;
objFPData : IFPData; //
szFIRTextData : wideString;//Store The Finger Print Data after Encode.
biFIR1,biFIR2,biFIR_First,biFIR_Second : array of byte; //Store The Finger Print Data Byte.
FirstFIR,SecondFIR : WideString; //objExtraction.TextEncodeFIR 指纹数据
arrFP : array[0..799] of byte;
调用COM:
objSecuBsp := CreateOleObject('SBSPCOM.SecuBSP');
objDevice := objSecuBSP.Device;
objExtraction := objSecuBSP.Extraction;
objMatching := objSecuBSP.Matching;
objFPData := IFPData(IUnknown(objSecuBSP.FPData));
调用取数据:
procedure TFrm_Capture.TimerFirstTimer(Sender: TObject);
var
len : Integer;
begin
try
TimerFirst.Enabled := False;
TimerSec.Enabled := False;
LblCptMsg.Caption := 'Put your finger on the sensor please!';
LblCptMsg.Refresh;
objDevice.Enumerate;
objDevice.Open(2); //
SetInitValue(PicFirst.Handle);
objExtraction.Capture(1);
Len := objExtraction.FIRLength;
biFIR1 := nil;
SetLength(biFIR1, Len); //biFIR
biFIR1 := objExtraction.FIR;
szFIRTextData := objExtraction.TextEncodeFIR;
FirstFIR := objExtraction.TextEncodeFIR;
objFPData.Export(biFIR1,2);
if objFPData.ErrorCode=0 then
begin
biFIR_First := nil;
Len := objFPData.FPDataSize[0];
SetLength(biFIR_First, len);
biFIR_First := objFPData.FPData[0,0];
end;
objDevice.Close(2);
//取完数据,关闭子窗口
Frm_Capture.Close;
except
end;
end;
//父窗口调用子窗口
procedure TFrm_Main.Button2Click(Sender: TObject);
begin
if not Assigned(Frm_Capture) then
Frm_Capture := TFrm_Capture.Create(nil);
Frm_Capture.Visible := False;
Frm_Capture.ShowModal;
sFPData2 := Frm_Capture.sFPData;//这个变量子窗口有的,
FreeAndNil(Frm_Capture);
end;
请教大家:由于某种原因,需要调用两次子窗口,在第一次调用并关闭时,一切正常(父窗口不会被关闭),
但是第二次关闭子窗口时,出现故障,父窗口被一起关闭,
并有时会出现异常错误:
Access Violation at address '十六进制数' in module 'ntdll.dll'.....