borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (runtime error 14 type mismatch and class loader error in vb)Next Topic (Help on sending and receiving sms using vb) New Topic New Poll Post Reply
AndreaVB Forum : VB General : fingerprint coding problem..
Poster Message
cempaka
Level: Big Cheese

Registered: 03-03-2009
Posts: 19

icon fingerprint coding problem..

hi there..
i have a fingerprint project..
im using a fingerprint device with smart card..
i had connected the device..
i done the initialization, the connection, and formatting the smart card..
but my problem now is for the enrolling..
when i click "ENROLL", my VB hang..and then forcing me to exit the program...
this is my coding for enroll..

Private Sub cmdENROLL_Click()

    Dim ppNewTemplateHLP As Long
    Dim indx As Integer
    Dim i As Integer
    
    
    Dim lngTimeout As Long
    ' Payload Data buffer
    Dim pPayloadBuffer() As Byte
    
    
    Dim pPayload As PT_DATA
    
    ShowCallBack True
    
    
    ' Get Payload data length
    
    pPayload.Length = CLng(Len(txtPayloadDataPC.Text))
    
    If pPayload.Length > 0 Then
        
        ReDim pPayload.Data(pPayload.Length - 1)
        
        For i = 1 To pPayload.Length

            pPayload.Data(i - 1) = AscB(Mid(txtPayloadDataPC.Text, i, 1))
        Next i
    
    End If
  
    ReDim pPayloadBuffer(4 + pPayload.Length)

    CopyMemory pPayloadBuffer(0), VarPtr(pPayload.Length), 4
    
    If pPayload.Length > 0 Then
        CopyMemory pPayloadBuffer(4), VarPtr(pPayload.Data(0)), pPayload.Length
    End If

    lngTimeout = 20000     ' default at -1

    lngResult = PTEnroll(phConnection, PT_PURPOSE_ENROLL, 0&, VarPtr(ppNewTemplate), 0&, pPayloadBuffer(0), lngTimeout, 0&, 0&, 0&)
    
  
    ppNewTemplateHLP = ppNewTemplate
    CopyMemory AppMemory.Header, ppNewTemplate, 16
    ppNewTemplate = ppNewTemplateHLP
    ReDim AppMemory.FullBIRData(AppMemory.Header.Lenght)
    CopyMemory AppMemory.FullBIRData(0), ppNewTemplate, AppMemory.Header.Lenght
  
    PTFree ppNewTemplateHLP

    AppMeNr = AppMeNr + 1
    
    
    DisplayResult "PTEnroll: " & lngResult
    
    DisplayResult "Result String : " & GetErrorString(lngResult)
    
        
    ShowCallBack False


End Sub


plz help me..
thanks.

one more thing, im using win vista..
is it not very compatible with VB?

02-04-2009 at 01:16 PM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 601
icon Re: fingerprint coding problem..

well,

I can say that VB6 works well in Vista for me, never had problems with my old and new source codes.
What do you mean that the app hangs? did you try hitting Ctrl-Break to stop it to see if execution in blocked in some loop? maybe you can use a lower timeout, I see you used 20000, are they seconds or milliseconds?

are you using a set of DLLs provided with the device?
did you try to debug each instruction setting some breakpoint inside your code?

let us know about it...

____________________________
AndreaVB

02-04-2009 at 01:37 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
cempaka
Level: Big Cheese

Registered: 03-03-2009
Posts: 19
icon Re: fingerprint coding problem..

thanks to admin

i dont know is the problem..
because for the initialization and connection, it has no problem..
but when it comes to enroll, it hangs..

yup..im using the dll provided..

02-04-2009 at 01:59 PM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 601
icon Re: fingerprint coding problem..

hello,

why don't you try to debug it?
maybe you aren't used to VB debug features...let me try to explain:
you can place a breakpoint inside your code, maybe at the beginning of your routine and then go forward one istruction at a time.
so try this: place the cursor at the first instruction in your subroutine and press F9, you'll see a red dot at the left side of your code, this means that you have inserted a breakpoint.
Then run your code (F5), when you'll go into your enroll process and program execution reaches the breakpoint line, your program will stop and you'll be taken back to vb, then pressing Shift+F8, execuition will go forward one instruction, keep pressing Shift+F8 until in hangs, then you will know what is the instruction that is blocking your program.
If you want to continue with standard execution press F5 again...

hope it helps,
let me know if you got results

____________________________
AndreaVB

02-04-2009 at 02:31 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
cempaka
Level: Big Cheese

Registered: 03-03-2009
Posts: 19
icon Re: fingerprint coding problem..

thank admin..
i got it..
it hangs at this line

CopyMemory AppMemory.Header, ppNewTemplate, 16
ppNewTemplate = ppNewTemplateHLP

oh please help me...
what to do..

02-04-2009 at 03:59 PM
View Profile Send Email to User Show All Posts | Quote Reply
cempaka
Level: Big Cheese

Registered: 03-03-2009
Posts: 19
icon Re: fingerprint coding problem..

i try to comment the line that make the app hangs..
but it result an error that "PerfectTrust API wasn't initialized"..
what do i have to do?

02-04-2009 at 04:16 PM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 601
icon Re: fingerprint coding problem..

maybe this line doesn't return a valid code so all subsequent use of the variables cause the error

lngResult = PTEnroll(phConnection, PT_PURPOSE_ENROLL, 0&, VarPtr(ppNewTemplate), 0&, pPayloadBuffer(0), lngTimeout, 0&, 0&, 0&)

check lnrResult after this call to see if it returns some errors...do you have some documentation about these calls you are using? what should be the value of lngReturn if everything goes OK...

I'll try to help you as I can since I don't have the device to test....

let me know...

PS: CopyMemory is dangerous if used with wrong parameters...as you see it hangs the app...      

[Edited by admin on 02-04-2009 at 06:13 PM GMT]

____________________________
AndreaVB

02-04-2009 at 05:12 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
cempaka
Level: Big Cheese

Registered: 03-03-2009
Posts: 19
icon Re: fingerprint coding problem..

ok..
after that line, the value that return is the same as the error that occur..
that is -1002..
if its ok, it should be 0..
what to do now?
im a newbie.

thanks admin..

02-04-2009 at 05:22 PM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 601
icon Re: fingerprint coding problem..

well,

what to do now is the hardest part...  
based on your documentation, what is this error supposed to mean? is there some troubleshooting guide or error resolution guide?

____________________________
AndreaVB

03-04-2009 at 06:57 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
cempaka
Level: Big Cheese

Registered: 03-03-2009
Posts: 19
icon Re: fingerprint coding problem..

i dont think there are some trouble shooting guide..
like i said before, the error means that "PerfectTrust API wasn't initialized..
oh my god.
what to do.
time is running out..
i really need help.

03-04-2009 at 07:02 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 601
icon Re: fingerprint coding problem..

PayLoadBuffer is loaded with correct informations? all operations you take before calling PTEnroll are correct? I don't know what else I can do for you...there's the need of some documentation about your device...

____________________________
AndreaVB

03-04-2009 at 08:32 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB General : fingerprint coding problem..
Previous Topic (runtime error 14 type mismatch and class loader error in vb)Next Topic (Help on sending and receiving sms using vb) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder