QueryCapability Method

Summary

Gets all of the supported values for the requested capability.

Syntax
C#
VB
C++
public TwainCapability QueryCapability( 
   TwainCapabilityType type 
) 
Public Function QueryCapability( _ 
   ByVal type As TwainCapabilityType _ 
) As TwainCapability 
public: 
TwainCapability^ QueryCapability(  
   TwainCapabilityType type 
)  

Parameters

type
Indicates the capability to get.

Return Value

A TwainCapability object representing all of the supported values of the requested capability.

Remarks

For more information, refer to Freeing the TWAIN Session.

Example
C#
VB
using Leadtools; 
using Leadtools.Twain; 
 
public void QueryCapabilityExample(IntPtr parent) 
{ 
   try 
   { 
      TwainSession twnSession = new TwainSession(); 
      twnSession.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); 
 
      TwainCapability twCap = twnSession.QueryCapability(TwainCapabilityType.ImageUnits); 
 
      if (twCap.Information.ContainerType == TwainContainerType.OneValue) 
      { 
         if (twCap.OneValueCapability.Value != (object)TwainCapabilityValue.UnitInches) 
         { 
            twCap.OneValueCapability.Value = TwainCapabilityValue.UnitInches; 
            twnSession.SetCapability(twCap, TwainSetCapabilityMode.Set); 
         } 
      } 
      twnSession.Shutdown(); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show(ex.Message); 
   } 
} 
Imports Leadtools 
Imports Leadtools.Twain 
 
 
Public Sub QueryCapabilityExample(ByVal parent As IntPtr) 
   Try 
      Dim twnSession As TwainSession = New TwainSession() 
      twnSession.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None) 
 
      Dim twCap As TwainCapability = twnSession.QueryCapability(TwainCapabilityType.ImageUnits) 
 
      If twCap.Information.ContainerType = TwainContainerType.OneValue Then 
         If CType(twCap.OneValueCapability.Value, TwainCapabilityValue) <> TwainCapabilityValue.UnitInches Then 
            twCap.OneValueCapability.Value = TwainCapabilityValue.UnitInches 
            twnSession.SetCapability(twCap, TwainSetCapabilityMode.Set) 
         End If 
      End If 
      twnSession.Shutdown() 
   Catch ex As Exception 
      MessageBox.Show(ex.Message) 
   End Try 
End Sub 

Requirements

Target Platforms

Help Version 20.0.2019.9.19
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Twain Assembly