The following table shows Visual Basic data types that correspond to DTWAIN data types (32-bit applications).
DTWAIN Data Type
|
VB .NET Type
|
Visual Basic 6.0 and below
|
DTWAIN_ARRAY
|
Integer
|
Long
|
DTWAIN_CALLBACK_PROC
|
Delegate
|
Long
|
DTWAIN_BOOL
|
Integer
|
Long
|
DTWAIN_FLOAT
|
Double
|
Double
|
DTWAIN_FRAME
|
Integer
|
Long
|
DTWAIN_OCRENGINE
|
Integer
|
Long
|
DTWAIN_PDFTEXTELEMENT
|
Integer
|
Long
|
DTWAIN_RANGE
|
Integer
|
Long
|
DTWAIN_SOURCE
|
Integer
|
Long
|
HANDLE
|
Integer
|
Long
|
LONG, DTWAIN_LONG
|
Integer
|
Long
|
DTWAIN_LONG64
|
Long
|
Not available
|
LPCTSTR
|
String
|
String
|
LPDTWAIN_ARRAY
|
Integer (passed ByRef)
|
Long (passed ByRef)
|
LPDTWAIN_FLOAT
|
double (passed ByRef)
|
Long (passed ByRef)
|
LPLONG
|
Integer (passed ByRef)
|
Long (passed ByRef)
|
LPTSTR
|
String
|
String
|
LPVOID
|
Integer (passed ByRef)
|
Long (passed ByRef)
|
TWAIN_IDENTITY
|
Integer
|
Long
|
• | VB .NET/2005/2008/2010 considers 32-bit types as Integer, while DTWAIN considers 32-bit types LONG. Make sure that when declaring a LONG type variable in VB .NET, you actually declare the variable as /nteger. For a 64-bit types, the Long data type of VB.NET is a 64-bit integer type. |
• | For VB .NET/2005/2008/2010, DTWAIN_SetCallback must use a delegate as the function pointer argument. Delegates are discussed in most VB .NET/2005/2008/2010 books, tutorials, etc. so it will not be discussed here except to state that delegates are VB .NET/2005/2008/2010 equivalent to a function pointer. |
For 64-bit applications, the VB.NET/2005/2008/2010 types are as follows:
DTWAIN Data Type
|
VB .NET Type
|
DTWAIN_ARRAY
|
Long
|
DTWAIN_CALLBACK_PROC
|
Delegate
|
DTWAIN_BOOL
|
Long
|
DTWAIN_FLOAT
|
Double
|
DTWAIN_FRAME
|
Long
|
DTWAIN_OCRENGINE
|
Long
|
DTWAIN_PDFTEXTELEMENT
|
Long
|
DTWAIN_RANGE
|
Long
|
DTWAIN_SOURCE
|
Long
|
HANDLE
|
Long
|
LONG, DTWAIN_LONG
|
Integer
|
DTWAIN_LONG64
|
Long
|
LPCTSTR
|
String
|
LPDTWAIN_ARRAY
|
Long (passed ByRef)
|
LPDTWAIN_FLOAT
|
double (passed ByRef)
|
LPLONG
|
Integer (passed ByRef)
|
LPTSTR
|
String
|
LPVOID
|
Integer (passed ByRef)
|
TWAIN_IDENTITY
|
Long
|
|