L_TwainSetVersion

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainSetVersion(TwainVersion)

TWAIN_VERSION TwainVersion;

the twain version to use

Sets the desired TWAIN version to work with.

Parameter

Description

TwainVersion

The TWAIN version to use. For possible values, refer to the TWAIN_VERSION enumeration.

Returns

SUCCESS

The function was successful.

!= SUCCESS

An error occurred. Refer to Return Codes.

Comments

The default behavior of the LEADTOOLS TWAIN toolkit is to look for the TWAIN v2.x DLL first. If TWAIN v2.x is not found or the scanner does not support TWAIN v2.x,  then the toolkit looks for the TWAIN v1.9 DLL and tries to load it.

Use L_TwainSetVersion to override the default behavior of the L_TwainSelectSource function. Calling L_TwainSetVersion stops the toolkit from looking for the TWAIN v2.x DLL first. Instead, it turns responsibility for checking driver/data source compatibility over to the user for the rest of the session. If L_TwainSelectSource is called after L_TwainSetVersion, the toolkit will change the source but will not perform automatic version checking.

To determine which TWAIN version is currently being used, call L_TwainGetVersion.

When using L_TwainSetVersion, there is no need to rename or delete any of the TWAIN version DLLs from the system directory. The TWAIN v1.9 DLL name is "Twain_32.dll" and the TWAIN v2.x DLL name is "TWAINDSM.DLL". 

If the function returns SUCCESS, there is no need to call the L_IsTwainAvailable function since it will be called internally.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files to be Included with your Application.

See Also

Functions:

L_IsTwainAvailableL_TwainGetVersionL_TwainInitSession2

Topics:

Programming with LEADTOOLS TWAIN Functions

 

TWAIN Functionality: Property Functions

Setting which TWAIN Specification Version to use

Using LEADTOOLS THUNK Utility with TWAIN

Example

L_INT TwainSetVersionExample(TWAIN_VERSION TwainVersion, HTWAINSESSION g_hSession) 
{ 
   L_INT nRet; 
   nRet = L_TwainSetVersion(TwainVersion); 
   if (nRet != SUCCESS) 
   { 
      MessageBox (NULL, TEXT("Failed to set twain version"), TEXT("ERROR"), MB_OK); 
      return nRet; 
   } 
   // Show the Twain Select Source UI 
   nRet = L_TwainSelectSource(g_hSession, NULL); 
   if (nRet != SUCCESS) 
   { 
      MessageBox (NULL, TEXT("Error occurred while selecting the source."),TEXT( "ERROR"), MB_OK); 
      return nRet; 
   } 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.19
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS TWAIN C API Help