![]() |
C++ DLL Header -> Delphi (Struct)
Moin Moin,
so langsam blicke ich bei der übersetzung durch, naja zumindest bei den einfachen dingen :-) Nun ist bei mir leider ein neues Problem aufgetreten, und zwar das folgende:
Code:
//$e-----------------------------------------------------------------------------------------------
// @EnrollEx // // Function : Enrolls one finger : Creates a template from a set of acquisitions. // // Input : pstEnrolledTemplate->dwTemplateSize supplies the buffer size. // (must be at least TEMPLATE_SIZE). // pUpdateFunc points to a callback function that updates execution status. // pvObject points to an object (context) used by pUpdateFunc. // pCompletionRoutine points to a completion routine called when the operation // ends. If this callback is defined, this function behaviour // is asynchronous (See Info section) // pvContext points to a context passed to pCompletionRoutine. // // Output : pstEnrolledTemplate points to the enrolled template if the operation // succeeded. // // Returns : RCDone if the operation succeeded. // RCFailed if the operation failed. // RCAborted if the operation has been aborted. // RCNoDevice if no acquisition device has been found. // RCNoSensor if there is no sensor or if the sensor is defective. // RCOpenFailed if there is a problem while opening the device. // RCBufferTooSmall if the buffer named pstEnrolledTemplate->pbyTemplate is too small // RCAllocationFailed if a dynamic allocation failed // (lack of memory resource) // // Info : If pCompletionRoutine is NULL, this function will not return until the end // of the operation, and will consequently have a synchronous behaviour. //$e----------------------------------------------------------------------------------------------- DLLIMPORT DWORD EnrollEx( PSTBioTemplateEx const pstEnrolledTemplate, void (*pUpdateFunc)(PVOID,DWORD) = NULL, PVOID pvObject = NULL, void (*pCompletionRoutine)(DWORD,PVOID) = NULL, PVOID pvContext = NULL); //$e-----------------------------------------------------------------------------
Code:
Daraus habe ich bisher folgendes gemacht:
// Template
typedef struct { DWORD dwTemplateSize; DWORD dwTemplateID; BYTE* pbyTemplate; } STBioTemplateEx, *PSTBioTemplateEx;
Delphi-Quellcode:
probleme bereitet mir der erste Parameter, ich habe ich schon die folgende Funktion Variante getestet:
type
PSTBioTemplateEx = packed record dwTemplateSize : DWORD; dwTemplateID : DWORD; pbyTemplate: array [0..288] of DWORD; end; function EnrollEx (pstEnrolledTemplate : Pointer; pUpdateFunc : Pointer; pvUpdateCOntext : Pointer; pCompletionRoutine: Pointer; pvCompletionContext : Pointer): DWORD; cdecl; external 'BiometricDll.dll';
Delphi-Quellcode:
Leider bisher alles ohne Erfolg, ich vermute, dass ich mich irgendwo grundlegend verrant habe :-)
function EnrollEx (var pstEnrolledTemplate : PSTBioTemplateEx ; pUpdateFunc : Pointer; pvUpdateCOntext : Pointer; pCompletionRoutine: Pointer; pvCompletionContext : Pointer): DWORD; cdecl; external 'BiometricDll.dll';
Ich bekomme keine Fehlermeldung zurück, aber das Gerät macht nichts, in anderen Anwendungen geht es wunderbar :-( (Demo Project in C++) Wer von euch hat ne Idee! Wäre super...! Und mit "Erklärung" wäre es genial.. Besten Dank & |
Re: C++ DLL Header -> Delphi (Struct)
Ist erst mal erledigt, die Größe von
Delphi-Quellcode:
war falsch....
pbyTemplate: array [0..648] of DWORD;
Danke :-) |
Re: C++ DLL Header -> Delphi (Struct)
Delphi-Quellcode:
Der erste Parameter stEnrolledTemplate war falsch deklariert. Das var bewirkt eine Indirektion, also ist der Typ vom Pointer auf die Struktur aud den Strukturtyp zu aendern.
type
TUpdateFunc = procedure(Param1: Pointer; Param2: DWORD); cdecl; TCompletionRoutine = procedure(Param1: DWORD; Param2: Pointer); cdecl; function EnrollEx(var stEnrolledTemplate: STBioTemplateEx; UpdateFunc: TUpdateFunc = nil; pvUpdateCOntext: Pointer = nil; CompletionRoutine: TCompletionRoutine = nil; pvCompletionContext: Pointer = nil): DWORD; cdecl; external 'BiometricDll.dll'; Die Parameter sind Callback-Prozeduren und ein zugehoeriger Context-Pointer den man bestimmt zu beliebigen Zwecken einsetzen kann. Der duerfte als der Pointer-Parameter der Callback-Prozedur uebergeben werden. Die Defaultwerte fuer die Parameter kann man auch in Delphi implementieren. |
Re: C++ DLL Header -> Delphi (Struct)
Danke! Läuft alles :-)
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:06 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz