Leadtools.Twain Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.8.31
QueryCapability Method
See Also  Example
Leadtools.Twain Namespace > TwainSession Class : QueryCapability Method




type
Indicates the capability to get.
Gets all the supported values of the requested capability.

Syntax

Visual Basic (Declaration) 
Public Function QueryCapability( _
   ByVal type As TwainCapabilityType _
) As TwainCapability
Visual Basic (Usage)Copy Code
Dim instance As TwainSession
Dim type As TwainCapabilityType
Dim value As TwainCapability
 
value = instance.QueryCapability(type)
C# 
public TwainCapability QueryCapability( 
   TwainCapabilityType type
)
Managed Extensions for C++ 
public: TwainCapability* QueryCapability( 
   TwainCapabilityType type
) 
C++/CLI 
public:
TwainCapability^ QueryCapability( 
   TwainCapabilityType type
) 

Parameters

type
Indicates the capability to get.

Return Value

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

Example

Visual BasicCopy Code
Public Sub QueryCapabilityExample(ByVal parent As IWin32Window)
   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
C#Copy Code
public void QueryCapabilityExample(IWin32Window 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); 
   } 
}

Remarks

For more information, refer to Freeing the TWAIN Session.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also