How to Work with the Containers – Visual Basic

Due to differences in Visual Basic and MFC, LEADTOOLS provides interfaces specifically for working with containers in VB. These are discussed here.

When getting or setting capability information it may be necessary to create a container for the capability. The structure of the container depends on the type of information in the container. LEADTOOLS supports the following types of TWAIN containers:

L_TWON_ARRAY

L_TWON_ENUMERATION

L_TWON_ONEVALUE

L_TWON_RANGE

For more information on these container types, refer to the TWAIN 1.9 Specification, available at www.twain.org.

The LEADTOOLS TWAIN toolkit provides an interface for each container type and the TW_CAPABILITY structure.

The ILEADTwainCapability interface represents the capabilities; so to get the TW_CAPABILITY, use the CapInfo property, which contains an ICapability2 interface that represents the TW_CAPABILITY structure. This interface has three properties that are used to get and set capabilities:

image\sqrblit.gif The Capability property, which contains the capability constant that indicates the specific capability when the capability constant is a short value.

image\sqrblit.gif The CapabilityLong property, which contains the capability constant that indicates the specific capability when the capability constant is a short value.

image\sqrblit.gif The ConType property, which defines the type of the container to use when setting the capability or the container used to get the capability values. The possible container types are defined in the ICapabilityOneValue2, ICapabilityEnumeration2, ICapabilityArray2, and ICapabilityRange2 interfaces. They can be obtained by using one of the following properties CapArray property, CapEnum property, CapOneValue property and CapRange property.

The ICapabilityOneValue2 interface represents a container of type TW_ONEVALUE. This interface has the following properties:

image\sqrblit.gif The OneValItemType property contains the type of data contained in the ICapabilityOneValue2 interface).

image\sqrblit.gif The OneValCapValue property contains the actual value of the ICapabilityOneValue2 interface.

The ICapabilityEnumeration2 interface represents a container of type TW_ENUMERATION. This interface has the following properties:

image\sqrblit.gif The EnumItemType property contains the type of data contained in the ICapabilityEnumeration2 interface.

image\sqrblit.gif The EnumCapValue property contains the actual value(s) of the ICapabilityEnumeration2 interface.

image\sqrblit.gif The EnumNumOfItems property contains the number of values in the ICapabilityEnumeration2 interface.

image\sqrblit.gif The EnumCurrentIndex property contains the index of the current value of the ICapabilityEnumeration2 interface.

image\sqrblit.gif The EnumDefaultIndex property contains the index of the default value of the ICapabilityEnumeration2 interface.

The ICapabilityRange2 interface represents a container of type TW_RANGE. This interface has the following properties:

image\sqrblit.gif The RangeItemType property contains the type of data contained in the ICapabilityRange2 interface.

image\sqrblit.gif The RangeCurrentValue property contains the current value of the ICapabilityRange2 interface.

image\sqrblit.gif The RangeDefaultValue property contains the default value of the ICapabilityRange2 interface.

image\sqrblit.gif The RangeMinimumValue property contains the minimum value in the range of the ICapabilityRange2 interface.

image\sqrblit.gif The RangeMaximumValue property contains the maximum value in the range of the ICapabilityRange2 interface.

image\sqrblit.gif The RangeStepSize property contains the step size in the range of the ICapabilityRange2 interface.

The ICapabilityArray2 interface represents a container of type TW_ARRAY. This interface has the following properties:

image\sqrblit.gif The ArrayItemType property contains the type of data contained in the ICapabilityArray2 interface.

image\sqrblit.gif The ArrayCapValue property contains the actual value(s) of the ICapabilityArray2 interface.

image\sqrblit.gif The ArrayNumOfItems property contains the number of items in the ICapabilityArray2 interface.

The ItwFrame interface represents a structure of type TW_FRAME. It contains information about the area of the image to acquire. This interface has the following properties:

image\sqrblit.gif The RightMargin property contains the right margin value.

image\sqrblit.gif The LeftMargin property contains the left margin value.

image\sqrblit.gif The TopMargin property contains the top margin value.

image\sqrblit.gif The BottomMargin property contains the bottom margin value.