Accusoft.TwainPro9.ActiveX
Check Capabilities

Data Sources have different capabilities (e.g. levels of resolution, support of color or black and white images, automatic document feeder available, etc.). Applications can check the capabilities available for the selected Data Source, and can also set those capabilities to its desired settings. 

Capabilities can be checked once a TWAIN Session has been opened (OpenSession), and before or after a scanning session has been initiated (StartSession).

Select a Capability to Check

First specify the capability to be read, by setting the Capability property.

Check that the Capability is supported by the Data Source

To determine whether the selected Capability is supported by the Data Source, read the CapSupported property.

Check the Type of Container used by the Data Source

If the capability is supported by the Data Source, read the CapType property to determine the type of container used by the Data Source to pass values back to TwainPRO™. 

Read the Capability Values

The relevant properties to access for a capability are determined by the container used (CapType). TWAIN defines four types of containers to negotiate values between the application (TwainPRO) and the Source:

Relevant Properties To Check: CapValue 

Relevant Properties To Check: CapValue, CapDefault, CapNumItems, CapItem 

Relevant Properties To Check: CapValue, CapDefault, CapMin, CapMax, CapStep 

Relevant Properties To Check: CapNumItems, CapItem 

VB Example
Copy Code
' This code demonstrates how to read a value
' Check for support and stop if none
If (TwainPRO.CapSupported = False) Then
LblDefault.Caption = "Not supported"
LblDefault.Visible = True
Exit Sub
End If
' What data type is the Cap? We have to check the
' data type to know which properties are valid
Select Case TwainPRO.CapType
' Type ONEVALUE only returns a single value
Case TWON_ONEVALUE
EdtCurrent.Text = TwainPRO.CapValue
EdtCurrent.Visible = True
' Type ENUM returns a list of legal values as
' well as current and default values. A list
' of constants is returned and the CapDesc
' property can be used to find out what the
' constants mean
Case TWON_ENUM
EdtCurrent.Text = TwainPRO.CapValue
EdtCurrent.Visible = True
LblDefault.Caption = "Default = " & TwainPRO.CapDefault
LblDefault.Visible = True
List1.AddItem "Legal Values:"
For Index = 0 To TwainPRO.CapNumItems - 1
List1.AddItem TwainPRO.CapItem(Index) & " - " & TwainPRO.CapDesc(TwainPRO.CapItem(Index))
Next
List1.Visible = True
' Type ARRAY returns a list of values, but no
' current or default values.
Case TWON_ARRAY
List1.AddItem "Legal Values:"
For Index = 0 To TwainPRO.CapNumItems - 1
List1.AddItem TwainPRO.CapItem(Index)
Next
' Returns a range of values as well as current and
' default values
Case TWON_RANGE
EdtCurrent.Text = TwainPRO.CapValue
EdtCurrent.Visible = True
LblDefault.Caption = "Default = " & TwainPRO.CapDefault
LblDefault.Visible = True
LblMin.Caption = "MinValue = " & TwainPRO.CapMin
LblMin.Visible = True
LblMax.Caption = "MaxValue = " & TwainPRO.CapMax
LblMax.Visible = True
End Select

 

See Also

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback