Getting and Setting Capabilities
Each TWAIN source may support a number of capabilities. These capabilities dictate the behavior of the TWAIN source. Before acquiring images from the selected TWAIN source, the user may wish to examine and change the capability settings for that source.
It is possible to check whether the installed scanner to the system supports certain capabilities. For more information, refer to How to Find Out Whether Your Scanner Supports Certain Capabilities Using Twacker, found on http://support.leadtools.com/SupportPortal/cs/forums/3781/ShowPost.aspx.
The LEADTOOLS TWAIN toolkit provides the user low-level and high-level functionality for getting and setting the capabilities.
LEADTOOLS provides both low-level and high-level methods for getting and setting capabilities. The low-level methods get and set capabilities individually. The high-level methods let the user get and set a specific group of capabilities, be getting and setting properties in a structure.
Low-Level:
To get information about the capabilities
supported by the selected TWAIN source, set EnableEnumCapabilityEvent
property to TRUE and call the EnumCapabilities
method. For each capability enumerated by EnumCapabilities, this method
will generate the OnEnumCapabilityEvent
Event. Within this event the user can process the capability information.
To get information on a specific capability
(current, default, or all possible values) call the GetCapability
method. This method gets information about the capability specified
in a TW_CAPABILITY structure. For more information about TW_CAPABILITY,
refer to the TWAIN 1.9 specification from the site www.twain.org.
To set a specific capability to a new value
or to reset the value of a capability to the default value, call SetCapability
method.
High-Level:
GetProperties
and SetProperties methods
allow the user to get and set a number of capabilities through the LTWAINPROPERTIES structure.
If this structure does not have the capability needed to negotiate, user
may use the low-level methods to do so.
To get each property set through an event, set EnableSetPropertiesEvent to TRUE and handle the OnSetPropertiesEvent Event.
The QueryProperty
method lets the user get the available values for a specific capability
from the selected source, to free the ppltProperty parameter was allocated
by calling the QueryProperty
method call FreePropQueryStructure
method.
When working with TW_CAPABILITY structures it may be necessary to create a container associated with that structure. For more information on containers, refer to How to Work with the Containers.