#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. |
SUCCESS |
The function was successful. |
!= SUCCESS |
An error occurred. Refer to Return Codes. |
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. |
Functions: |
|
Topics: |
|
|
|
Using LEADTOOLS THUNK Utility with TWAIN |
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;
}