Leadtools TWAIN (Leadtools.Twain assembly)
LEAD Technologies, Inc

SetVersion Method

Example 





The twain version to set, see TwainVersion for list of available versions.
Sets the desired Twain version to work with.
Syntax
public static void SetVersion( 
   TwainVersion twainVersion
)
'Declaration
 
Public Shared Sub SetVersion( _
   ByVal twainVersion As TwainVersion _
) 
'Usage
 
Dim twainVersion As TwainVersion
 
TwainSession.SetVersion(twainVersion)
public static void SetVersion( 
   TwainVersion twainVersion
)
 function Leadtools.Twain.TwainSession.SetVersion( 
   twainVersion 
)
public:
static void SetVersion( 
   TwainVersion twainVersion
) 

Parameters

twainVersion
The twain version to set, see TwainVersion for list of available versions.
Remarks
This method overrides the default Twain (version 2) used for scanning. This allows the Twain version to be changed without the need to rename of delete any of the Twain version DLLs from the system directory. The Twain version 1 DLL name is Twain_32.dll and version 2 DLL name is TWAINDSM.DLL, if this method is not called the engine will keep the default behavior and look for Twain version 2 first. If version 2 does not exist it will then look for Twain version1.
If this method is called and returns SUCCESS there is no need to call Leadtools.Twain.TwainSession.IsAvailable since this internally calls it.
Example
 
Public Sub SetVersionExample(ByVal twainVersion As TwainVersion)
   Dim session As TwainSession = New TwainSession()

   Try
      TwainSession.SetVersion(twainVersion)
      session.Startup(Nothing, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None)
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try

   session.Shutdown()
End Sub
public void SetVersionExample(TwainVersion twainVersion)
{
   TwainSession session = new TwainSession();

   try
   {
      TwainSession.SetVersion(twainVersion);
      session.Startup(null, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None);
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.Message);
   }

   session.Shutdown();
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

TwainSession Class
TwainSession Members
IsAvailable Method

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.