#include "ltwrappr.h"
L_INT LTwain::SetVersion(TwainVersion)
Sets the desired Twain version to work with.
The desired Twain version to work with. For possible values, refer to TWAIN_VERSION enumeration.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function is used to override the default Twain version (which is TWAIN v2.x).
Using this function, 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 TWAIN v2.x DLL name is "TWAINDSM.DLL". If this function is not called the engine will keep the default behavior which is looking for TWAIN v2.x first, and if it does not exist then look for TWAIN v1.0.
If the function returned SUCCESS, there is no need to call LTwain::IsAvailable function since it will be called internally.
Required DLLs and Libraries
L_INT LTwain__SetVersionExample(TWAIN_VERSION TwainVersion)
{
L_INT nRet;
LTwain MyClass;
APPLICATIONDATA AppData;
nRet = MyClass.SetVersion(TwainVersion);
if(nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to set Twain version"), TEXT("ERROR"), MB_OK);
return nRet;
}
AppData.uStructSize = sizeof(APPLICATIONDATA);
lstrcpy (AppData.szManufacturerName, TEXT("LEAD Technologies, Inc."));
lstrcpy (AppData.szAppProductFamily, TEXT("LEAD Test Applications"));
lstrcpy (AppData.szVersionInfo, TEXT("Version 1.0"));
lstrcpy (AppData.szAppName, TEXT("TWAIN Test Application"));
AppData.uLanguage = TWLG_ENGLISH_USA;
AppData.uCountry = TWCY_USA;
nRet = MyClass.InitSession(&AppData);
if (nRet != SUCCESS)
return nRet;
return SUCCESS;
}