Hi, I use Delphi 7. I have the following declaration of a C++ DLL Function:
UFS_STATUS UFS_API UFS_Extract(
HUFScanner hScanner,
unsigned char* pTemplate,
int* pnTemplateSize,
int* pnEnrollQuality
);
I declared in Delphi as:
function UFS_Extract(hScanner : Longint; var pTemplate
ByteArray; var pnTemplateSize :Longint; var pnEnrollQuality :Longint) :UFS_Status;stdcall external 'UFScanner.dll' name 'UFS_Extract';
It runs fine and I get the values of pnTemplateSize and pnEnrollQuality, but I don´t know how to access the pTemplateArray.
the body of the function that calls this function is:
var
fpBuffer : Array of PByte;
TSize, Quality : Longint;
begin
SetLength(fpBuffer,MAX_TEMPLATESIZE);
ufs_result:=UFS_Extract(Lector,PByteArray(fpBuffer[0]), TSize,Quality);
SetLength(fpBuffer,TSize);
I tried for example b:=fpBuffer[0]^ (where b is byte) but I get an access violation.
Any idea?
The correct code in VB6 is:
Dim hScanner As Long
Dim ufs_res As UFS_STATUS
Dim Template(MAX_TEMPLATE_SIZE - 1) As Byte
Dim TemplateSize As Long
Dim EnrollQuality As Long
ufs_res = UFS_Extract(hScanner, Template(0), TemplateSize, EnrollQuality)
Thanks
UFS_STATUS UFS_API UFS_Extract(
HUFScanner hScanner,
unsigned char* pTemplate,
int* pnTemplateSize,
int* pnEnrollQuality
);
I declared in Delphi as:
function UFS_Extract(hScanner : Longint; var pTemplate
It runs fine and I get the values of pnTemplateSize and pnEnrollQuality, but I don´t know how to access the pTemplateArray.
the body of the function that calls this function is:
var
fpBuffer : Array of PByte;
TSize, Quality : Longint;
begin
SetLength(fpBuffer,MAX_TEMPLATESIZE);
ufs_result:=UFS_Extract(Lector,PByteArray(fpBuffer[0]), TSize,Quality);
SetLength(fpBuffer,TSize);
I tried for example b:=fpBuffer[0]^ (where b is byte) but I get an access violation.
Any idea?
The correct code in VB6 is:
Dim hScanner As Long
Dim ufs_res As UFS_STATUS
Dim Template(MAX_TEMPLATE_SIZE - 1) As Byte
Dim TemplateSize As Long
Dim EnrollQuality As Long
ufs_res = UFS_Extract(hScanner, Template(0), TemplateSize, EnrollQuality)
Thanks