Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to get/capture value from Digital Persona FingerPrint ActiveX

Status
Not open for further replies.

dylim

Programmer
Dec 12, 2001
106
PH
Hi Everybody,

I am tinkering with a fingerprint scanner ActiveX control (Digital Persona).

Instantiating, dropping and working with it seems to go on smoothly... till the last event called Done() event, where it is supposed to return a "Fingerprint Template - FPTemplate" object variable.

This is the code I created in the ActiveX control's Done() event:


*** ActiveX Control Event ***
LPARAMETERS ptemplate

LOCAL lblobFingerPrint, lnResult

WAIT WINDOW NOWAIT "Creating Employee Record..." NOCLEAR

lblobFingerPrint

lnResult = ptemplate.Export( @lblobFingerPrint )

IF lnResult # Er_OK
MESSAGEBOX( "Error in getting Registration Template" )
RETURN
ENDIF

APPEND BLANK IN employee
replace employee.lastname WITH thisform.txtLastname.Value,;
employee.firstname WITH thisform.txtFirstname.Value,;
employee.fingerprnt WITH lblobFingerPrint

WAIT CLEAR


I get "Data type mismatch" using the above. Going thru the Debugger, the value of variable lblobFingerPrnt is always .F. and is never updated even when invoking the Export method.

This 'ptemplate' object variable, as per its documentation, has an Export method, like so:


Export([out] VARIANT* pVal, [out,retval] AIErrors *pErr)

* Exports the template object as a signed blob of bytes.
* This may then be saved by the developer in the database of his choice.

HELP! Obviously it has something to do with a VARIANT data type. Furthermore, the employee.fingerprint field is of Blob type. Doc also mentioned that it is a "byte array".

Thanks in advance!

Happy Holidays! Cheers!

Dennis
 
Dennis,

I'm not familiar with this control. However, I'm wondering about the line immediately after your WAIT WINDOW. This just says:

lblobFingerPrint

which I would've thought would raise a syntax error.

Since you are passsing lblobFingerPrint to the Export method by reference, you need to ensure that the variable exists, and is sufficiently large to hold the returned value, before you call the method.

You might try doing something like this before you call Export:

lblobFingerPrint = REPLICATE(CHR(0), 255)

Alternative, store a value in lblobFingerPrint that is the same size and data type as your employee.fingerprnt field.

Try that and report back.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Furthermore, the employee.fingerprint field is of Blob type. Doc also mentioned that it is a "byte array".

You cannot put a "byte array" into a blob field as far as I know. In the debugger can you determine if it is in fact an array?



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
MikeLewis,

Ooops... mea culpa... that line was supposed to read:

lblobFingerPrint = SPACE( 4096 )

When executed, it does not return any error at all, but checking on the Employee table, the value of EMPLOYEE.FINGERPRINT is merely 4096 spaces.

Actually, whatever value I initialize lblobFingerPrint with.. be it 0, or an empty string ""... it does not get updated or changed in value!

Aside from the code I posted, I have also since tried the following:

- COMARRAY( ptemplate, 11+1000 )
- lblobFingerPrint = CREATEBINARY( SPACE( 4096 ) )

FYI, the field EMPLOYEE.FINGERPRINT is of Blob type.

Thanks for any more inputs.

Dennis
 
mgagnon,

Thanks for your reply.

Checking on Debugger, it seems the 'culprit line':

lnResult = ptemplate.Export( @lblobFingerPrint )

does not update or change the value of var lblobFingerPrint - whether I initialize it with 0, "", or SPACE(4096) for that matter...

This, is my 'biggest' problem.

Should I create a 'byte array' variable to pass by reference? How does one create such in VFP? The reason why I used a blob field is because the docs said it returns a "blob of byte array".

Thanks once again.

Dennis

 
Dennis,

lblobFingerPrint = SPACE( 4096 )

That should be OK. In fact, it doesn't really matter what's in lblobFingerPrint before you call Export, provided it exists and it is large enough to hold the reply.

You don't need to put a blob or byte array or whatever in the variable before the call. You just need to figure out how to interpret the information in the variable after the call.

By the way, what's in lnResult after you have called Export? Presumably, it's some sort of error code. Maybe that will help you track down what went wrong.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
MikeLewis,

Hi.

The variable lnResult returned a value of zero (0), which, as per its documentation is the 'success' value.

But, no matter what value I initialize lblobFingerPrint with, be it:

lblobFingerPrint = ""
or
lblobFingerPrint = 0h
or
lblobFingerPrint = SPACE(4096)

After, the Export method, lblobFingerPrint retains the SAME value. Meaning, it did not change the value of lblobFingerPrint.

It seems the 'culprit line':

lnResult = ptemplate.Export( @lblobFingerPrint )

does not update or change the value of variable lblobFingerPrint - whether I initialize it with 0, "", or SPACE(4096) for that matter...

This, is my only stumbling block I believe.

Should I create a 'byte array' variable to pass by reference? How does one create such in VFP? The reason why I used a blob field is because the docs said it returns a "blob of byte array".

Thanks once again.

Dennis

 
The problem is VARIANT, you do everything all right by passing @lblobFingerprint to the Export method. But the ActiveX control get's in a BSTR data type, if you use @, which is not Variant, and therefore rises an error. You cannot pass in Variant pointers from VFP, thats a problem which can only be solved by creating a DLL with VB that makes that call with a real variant pointer and then copies the result to eg a vfp string with sufficient length (bytes) passed by reference.

See here about the variant pointer problem:

Bye, Olaf.
 
you may try to initialize with

lblobFingerPrint = createbinary(SPACE(4096))

And you may make it longer to retrieve more than 4k of fingerprint data, maybe it's just a size problem.

Bye, Olaf.

 
Olaf,

Thanks for your reply.

I checked out the link you gave. It says:

"Controls built with the ActiveX Template Library (ATL) do not have this problem."

The Digital Persona control is an ATL. So, why does it behave that way?

Anyway, I will do the other approach you suggested, that of using CREATEBINARY( SPACE(4096) ). Is there a way to find out the size of the returned value?

Thanks again.

Dennis
 
Olaf,

I just tried your other option, that of initializing:

lblobFingerPrint = CREATEBINARY( SPACE(4096) )

The value returned did not change/update lblobFingerPrint.

So, I increased it to:

lblobFingerPrint = CREATEBINARY( SPACE(40960) ) && read 40,960

Still, the value did not change/update lblobFingerPrint.

Gee, I have been stumped at this for days on end already. I am hoping for a Christmas miracle. =)

Thanks once again.

Dennis
 
Dennis,

Sorry I wasn't able to provide a solution earlier.

I see that Digital Persona have their own developers forum. Maybe you should post a question there -- or use it to try to make contact with any VFP folk there.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
MikeLewis,

I did register myself at their Developer's Forum. It took 2 days for the 'administrator' to acknowledge my application. He said that the application has to be 'approved' by the 'board'... So far no news yet!.. and it has been 4 days and counting!..

Geez!

Thanks anyway. Happy Holidays!

Dennis
 
Dennis:

Just guessing here.

try
* May require null terminated string.
lblobFingerPrint = replicate(chr(0),4096)

* Also try
*Export([out] VARIANT* pVal, [out,retval] AIErrors *pErr)
lError = replicate(chr(0),256))
Export(*lblobFingerPrint,@lError)

* Also try creating

dimension lblobFingerPrint[4096]
dimension lError[256]
* Try passing single and both parameters
Export(*lblobFingerPrint,@lError)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top