←Select platform

Startup Method


Initializes the TWAIN session.


public void Startup( 
   IntPtr owner, 
   string manufacturer, 
   string productFamily, 
   string version, 
   string application, 
   TwainStartupFlags flags 
Public Sub Startup( _ 
   ByVal owner As IntPtr, _ 
   ByVal manufacturer As String, _ 
   ByVal productFamily As String, _ 
   ByVal version As String, _ 
   ByVal application As String, _ 
   ByVal flags As Leadtools.Twain.TwainStartupFlags _ 
void Startup(  
   IntPtr owner, 
   String^ manufacturer, 
   String^ productFamily, 
   String^ version, 
   String^ application, 
   Leadtools.Twain.TwainStartupFlags flags 


The parent window handle. This cannot be NULL.

Optional name of the application's manufacturer.

Optional product family name.

Version information.

Optional application name.

Flag that determines the Startup method's behavior


Note that a TWAIN session is a communication session between LEADTOOLS TWAIN and your TWAIN sources. The internal TWAIN session handle that is created provides the user access to this TWAIN session. Startup or Startup2 must be called before calling any other methods that require a TWAIN session.

When the TWAIN session is no longer needed, end it by calling the Shutdown method. For each call to the Startup method there must be a call to the Shutdown method.

If you pass the UseThunkServer flag to the flags parameter, then the TWAIN session will be initialized using the THUNK server option. The only time to use the THUNK server is if you are using a TWAIN device that does not have a 64-Bit driver, and you are working on a 64-Bit operating system. In this case, this option will make it possible to detect and interact with your 32-Bit TWAIN driver/device from a 64-Bit process application.

Note: This method checks whether the currently selected TWAIN data source is TWAIN 2.x compliant. If the selected data source is TWAIN 2.x compliant, then the TWAIN 2.x data source manager (TWAINDSM.DLL) will be loaded from your system. The TWAIN version used will be TwainVersion2. If the selected data source is not TWAIN 2.x compliant, it will load the TWAIN 1.x data source manager (Twain_32.DLL) from your system. The TWAIN version used will be TwainVersion1, This checking will be done ONLY if the SetVersion method was NOT called by the user. To get the currently selected TWAIN version, call the GetVersion method.

Note: If this function throws a TwainExceptionCode::InvalidDll exception, most likely you have an old version of TWAINDSM.DLL in your system folder. Make sure you have at least version of this DLL. Download it from www.twain.org.

Note: If this function throws a TwainExceptionCode::NotInitialized exception while the UseThunkServer flag is used, then most likely the THUNK server (ltthunkserver.exe) failed to start. In this case you need to make sure ltthunkserver.exe is registered correctly and that all dependencies listed in Using thr LEADTOOLS THUNK Utility with TWAIN topic reside in the same folder where ltthunkserver.exe is located.

For more information, refer to Initializing a TWAIN Source, Freeing the TWAIN Session and Using thr LEADTOOLS THUNK Utility with TWAIN.


using Leadtools; 
using Leadtools.Twain; 
public void StartupExample(IntPtr parent) 
   TwainSession session = new TwainSession(); 
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); 
      session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); 
   catch (Exception ex) 
Imports Leadtools 
Imports Leadtools.Twain 
Public Sub StartupExample(ByVal parent As IntPtr) 
   Dim session As TwainSession = New TwainSession() 
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None) 
      session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None) 
   Catch ex As Exception 
   End Try 
End Sub 


Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Twain Assembly