How to Work with the Containers
When getting or setting capability information, it may be necessary to create a container for the associated TW_CAPABILITY structure. The structure of these containers depends on the type of information in the container. LEADTOOLS supports the following types of containers:
TW_ARRAY
TW_ENUMERATION
TW_ONEVALUE
TW_RANGE
For more information on these container types, refer to the TWAIN 1.9 Specification, available at www.twain.org.
For each type of container, LEAD provides a specific method:
CreateNumericContainerArray, allocates the container of the TW_CAPABILITY structure to be of type TW_ARRAY and fills it with the specified data.
CreateNumericContainerEnum, allocates the container of the TW_CAPABILITY structure to be of type TW_ENUMERATION and fills it with the specified data.
CreateNumericContainerOneValue, allocates the container of the TW_CAPABILITY structure to be of type TW_ONEVALUE and fills it with the specified data.
CreateNumericContainerRange, allocates the container of the TW_CAPABILITY structure to be of type TW_RANGE and fills it with the specified data.
The value in a container can be changed once the user has a pointer to the container. To change the value of a container, the user can call LockContainer, make the desired changes to the container value(s), and then call UnlockContainer. Alternately, the user can accomplish the same thing be calling the API GlobalLock and GlobalUnlock methods.
When the created container is no longer needed, it should be freed by calling FreeContainer method.
LEAD provides a number of methods for getting container values, based on the data type of the value. To get the data type of the value in a container, call GetNumericContainerItemType. Once the type is known, the following methods can be used to get the container value(s) from the TW_CAPABILITY structure:
GetNumericContainerSTRINGValue
To get the available values for a specific TWAIN capability, call QueryProperty. This method takes a pointer to a LTWAINPROPERTYQUERY structure, which will be updated with the available values for the capability.