I am developing an application which used DigitalPersona gold SDK 2.4
under VB.net 2003.
----------------------------------------------------------
api in C++
¡¾FT_startMonit oringDevice¡¿
FT_RETCODE FT_startMonitor ingDevice(
IN FT_HANDLE ftContext, /* device context */
IN FT_DEVICE_EVENT S_PT events); /* events handle */
¡¾FT_HANDLE¡¿
typedef void *FT_HANDLE;
¡¾FT_DEVICE_EVE NTS_PT¡¿
typedef struct
{
FT_HANDLE fingerTouching;
FT_HANDLE imageReady;
FT_HANDLE fingerRemoved;
FT_HANDLE error;
FT_HANDLE stop; /* ingnored */
}
FT_DEVICE_EVENT S, *FT_DEVICE_EVEN TS_PT;
----------------------------------------------------------
Now I declared the functiong in VB:
¡¾FT_startMonit oringDevice¡¿
Public Declare Function FT_startMonitor ingDevice Lib "DPFPFNS" _
(ByVal ctx As IntPtr, ByRef events As FT_DEVICE_EVENT S) As
Integer
¡¾FT_HANDLE¡¿
Dim CONTEX As IntPtr
¡¾FT_DEVICE_EVE NTS_PT¡¿
<StructLayout(L ayoutKind.Seque ntial)_
Public Structure FT_DEVICE_EVENT S
Public Event fingerTouching( )
Public Event imageReady()
Public Event fingerRemoved()
Public Event Herror()
Public Event Hstop() '/* ingnored */
End Structure
----------------------------------------------------------
Samples:
¡¾main¡¿
sub main()
....
AddHandler evnt.fingerRemo ved, AddressOf t1
AddHandler evnt.fingerTouc hing, AddressOf t2
AddHandler evnt.imageReady , AddressOf t3
AddHandler evnt.Herror, AddressOf t4
AddHandler evnt.Hstop, AddressOf t5
....
Dim thread1 As New Threading.Threa d(AddressOf
StartMonitoring Device)
thread1.Start()
....
end sub
Private Sub t2()
Console.WriteLi ne("t2")
End Sub
.....
'¡¾Call API¡¿
Private Sub StartMonitoring Device()
Dim rc As Integer
Try
rc = FT_startMonitor ingDevice(CONTE X, evnt)
Catch ex As Exception
console.writeli ne (ex.Message)
End Try
End Sub
----------------------------------------------------------
¡¾My Questions¡¿
the program can not hold the events so i wonder:
1. what's wrong?
2. How to declare and define the API function and it's
parameters,expe cially the events structure
i am a new one, any advise will be appreciated
thanks a lot!
under VB.net 2003.
----------------------------------------------------------
api in C++
¡¾FT_startMonit oringDevice¡¿
FT_RETCODE FT_startMonitor ingDevice(
IN FT_HANDLE ftContext, /* device context */
IN FT_DEVICE_EVENT S_PT events); /* events handle */
¡¾FT_HANDLE¡¿
typedef void *FT_HANDLE;
¡¾FT_DEVICE_EVE NTS_PT¡¿
typedef struct
{
FT_HANDLE fingerTouching;
FT_HANDLE imageReady;
FT_HANDLE fingerRemoved;
FT_HANDLE error;
FT_HANDLE stop; /* ingnored */
}
FT_DEVICE_EVENT S, *FT_DEVICE_EVEN TS_PT;
----------------------------------------------------------
Now I declared the functiong in VB:
¡¾FT_startMonit oringDevice¡¿
Public Declare Function FT_startMonitor ingDevice Lib "DPFPFNS" _
(ByVal ctx As IntPtr, ByRef events As FT_DEVICE_EVENT S) As
Integer
¡¾FT_HANDLE¡¿
Dim CONTEX As IntPtr
¡¾FT_DEVICE_EVE NTS_PT¡¿
<StructLayout(L ayoutKind.Seque ntial)_
Public Structure FT_DEVICE_EVENT S
Public Event fingerTouching( )
Public Event imageReady()
Public Event fingerRemoved()
Public Event Herror()
Public Event Hstop() '/* ingnored */
End Structure
----------------------------------------------------------
Samples:
¡¾main¡¿
sub main()
....
AddHandler evnt.fingerRemo ved, AddressOf t1
AddHandler evnt.fingerTouc hing, AddressOf t2
AddHandler evnt.imageReady , AddressOf t3
AddHandler evnt.Herror, AddressOf t4
AddHandler evnt.Hstop, AddressOf t5
....
Dim thread1 As New Threading.Threa d(AddressOf
StartMonitoring Device)
thread1.Start()
....
end sub
Private Sub t2()
Console.WriteLi ne("t2")
End Sub
.....
'¡¾Call API¡¿
Private Sub StartMonitoring Device()
Dim rc As Integer
Try
rc = FT_startMonitor ingDevice(CONTE X, evnt)
Catch ex As Exception
console.writeli ne (ex.Message)
End Try
End Sub
----------------------------------------------------------
¡¾My Questions¡¿
the program can not hold the events so i wonder:
1. what's wrong?
2. How to declare and define the API function and it's
parameters,expe cially the events structure
i am a new one, any advise will be appreciated
thanks a lot!
Comment