tfm.dll API call different results on VB6 and VB.Net

Ö

Özden Irmak

Hello There,

I'm coding an application which uses a library, "tfm.dll", to communicate
with a finger print reader.I'm converting the communication API function
declarations from the provided VB6 source codes to VB.Net and having a weird
issue :

The VB6 declaration of these functions are :



Public Declare Function PTInitialize Lib "tfm.dll" (ByVal pMemoryFuncs As
Any) As Long

Public Declare Function PTOpen Lib "tfm.dll" (ByVal pszDsn As String, ByRef
phConnection As Long) As Long



And here's the VB.Net equvalents that I ported :



Public Declare Function PTInitialize Lib "tfm.dll" (ByVal pMemoryFuncs As
Integer) As Integer

Public Declare Function PTOpen Lib "tfm.dll" (ByVal pszDsn As String, ByRef
phConnection As Integer) As Integer



In VB6, these are used to call these functions :



lngResult = PTInitialize(0&)

lngResult = PTOpen(pszDsn, phConnection)



In VB.Net, I use this way :



lngResult = PTInitialize(0) à I also used Nothing as the parameter and both
seems to work.

lngResult = PTOpen(pszDsn, phConnection)



In VB.Net, result of PTOpen always return as communication error where in
VB6 it works fine. The Initialize function works normally in VB.Net as I see
that the communication led on reader gets active when the Initialize
function is called and the return value is 0 which means everything is ok.



Does anybody has any idea why these two environments does not produce the
same result? Maybe some of you who has experience on those kind of ports can
point me to the right direction.



Many thanks in advance...



Özden
 
F

Family Tree Mike

I believe you should not have ported type "Any" to type "Integer" in
PTInitialize. I think it should be "IntPtr".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top