DTWAIN_ArraySetAt

Top  Previous  Next

The DTWAIN_ArraySetAt places an element in a DTWAIN_ARRAY.

 

DTWAIN_BOOL DTWAIN_ArraySetAt (

DTWAIN_ARRAY

Array

LONG

Index

LPVOID

pValue );

 

Parameters

Array

DTWAIN_ARRAY that the value will be placed.

 

Index

Position to place the element

 

pValue

32-bit pointer to the address of the value to set

 

Return Values

If the function succeeds, TRUE is returned.  If the function fails FALSE is returned.

 

Comments

The DTWAIN_ArraySetAt copies a value pointed to by pValue to a position in the DTWAIN_ARRAY Array.   The Index argument is the position to place the value, and must be in the range of 0 to n-1 where n is the number of elements in the array.  

 

Unlike DTWAIN_ArrayInsertAt or DTWAIN_ArrayAdd, the DTWAIN_ArraySetAt function replaces the value located at the position instead of inserting the value and moving existing elements down (or adding it to the end, as does DTWAIN_ArrayAdd).

 

The data type of the value located at the address pValue must match the data type that is stored in Array (see DTWAIN_ARRAY Data Types and DTWAIN Array Data Type Constants).  DTWAIN cannot determine the data type located at address pValue, therefore it is the responsibility of the programmer to provide the correct type.

 

For Visual Basic 6.0 and below:

If the DTWAIN array is DTWAIN_ARRAYSTRING, the DTWAIN_ArraySetAt parameter must be passed ByVal:

 

Example:

 

Dim SArray As Long

SArray = DTWAIN_ArrayCreate( DTWAIN_ARRAYSTRING, 1 )

DTWAIN_ArraySetAt SArray, 0, ByVal "Test"

 

TWAIN State Transitions

None.

 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

 

See Also

Adding, Setting, and Inserting elements in a DTWAIN_ARRAY