L_TwainSetVersion

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainSetVersion(TwainVersion)

TWAIN_VERSION TwainVersion;

/* the twain version to set */

Sets the desired Twain version to work with.

Parameter

Description

TwainVersion

The desired Twain version to work with. For possible values, refer to TWAIN_VERSION enumeration.

Returns

SUCCESS

The function was successful.

!= SUCCESS

An error occurred. Refer to Return Codes.

Comments

This function is used to override the default Twain version (which is TWAIN v2.0).

Using this function, there is no need to rename or delete any of the Twain version DLLs from the system directory. The TWAIN v1.0 DLL name is "Twain_32.dll" and TWAIN v2.0 DLL name is "TWAINDSM.DLL". If this function is not called the engine will keep the default behavior which is looking for TWAIN v2.0 first, and if it doesn't exist then look for TWAIN v1.0.

If the function returned SUCCESS, there is no need to call 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_IsTwainAvailable

Topics:

Programming with LEADTOOLS TWAIN Functions

 

TWAIN Functionality: Property Functions

Example

L_INT TwainSetVersionExample(TWAIN_VERSION TwainVersion)
{
   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;
}