DTWAIN_ARRAY Storage Types

Top  Previous  Next

There are different DTWAIN_ARRAY types that depend on the type of data that each one stores.  A DTWAIN_ARRAY may contain a sequence of integers, floating point values, DTWAIN_SOURCE's, Strings, and other data types.   When a DTWAIN_ARRAY is initialized by the application using DTWAIN_ArrayCreate, the data type must also be specified.  The supported data types and DTWAIN_ARRAY constants that define each type are as follows:

 

Data type

DTWAIN_ARRAY constant

DTWAIN_SOURCE

DTWAIN_ARRAYSOURCE

DTWAIN_FLOAT

DTWAIN_ARRAYFLOAT

LONG        

DTWAIN_ARRAYLONG

LONG64

DTWAIN_ARRAYLONG64

DTWAIN_STRING

DTWAIN_ARRAYSTRING

LPVOID

DTWAIN_ARRAYANY

DTWAIN_FRAME

DTWAIN_ARRAYFRAME

HANDLE

DTWAIN_ARRAYHANDLE

DTWAIN_BOOL

DTWAIN_ARRAYLONG

DTWAIN_ANSISTRING

DTWAIN_ARRAYANSISTRING

DTWAIN_WIDESTRING

DTWAIN_ARRAYWIDESTRING

 

All integer variables are stored as LONGS, including DTWAIN_BOOL.  DTWAIN expects the application to always use LONG variables when sending or retrieving integers from a DTWAIN_ARRAY.  If not, fatal runtime errors may occur.  Whenever your application initializes a DTWAIN_ARRAY, it must specify the type of data the array will store.  The DTWAIN_ARRAY constant defined above is used to specify the type.

 

 

String types

For string types, DTWAIN_ARRAY will either store 8-bit character types or 16-bit (Unicode or wide) character types. A single DTWAIN_ARRAY cannot hold both  string types at the same time.  A DTWAIN_ARRAYSTRING will hold either 8-bit or 16-bit character strings, depending on the version of DTWAIN DLL that is used.

 

For 8-bit character types, DTWAIN_ARRAYANSISTRING can be used.  If the DTWAIN DLL used is the ANSI version (DTWAIN32.DLL, DTWAIN64.DLL), then either DTWAIN_ARRAYSTRING or DTWAIN_ARRAYANSISTRING can be used to store 8-bit character strings.

 

For 16-bit character types, DTWAIN_ARRAYWIDESTRING can be used.  If the DTWAIN DLL used is the Unicode version (DTWAIN32U.DLL, DTWAIN64U.DLL), then either DTWAIN_ARRAYSTRING or DTWAIN_ARRAYWIDESTRING can be used to store 16-bit character strings.

 

You can store Unicode strings in an application that uses the ANSI version of DTWAIN by specifying the type of array as DTWAIN_ARRAYWIDESTRING.  Similarly, you can store ANSI strings in an application that uses the Unicode version of DTWAIN by specifying the type of array as DTWAIN_ARRAYANSISTRING.