Gets the version of TWAIN that is currently being used for this session.
#include "lttwn.h"
L_LTTWN_API L_INT L_TwainGetVersion(pTwainVersion)
When this function returns, this parameter will be updated with the TWAIN version currently used by this TWAIN session. For possible values, refer to the TWAIN_VERSION enumeration.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
!= SUCCESS | An error occurred. Refer to Return Codes. |
Use this function to determine which version of TWAIN is currently being used by the TWAIN session.
L_INT TwainGetVersionExample(HTWAINSESSION g_hSession)
{
L_INT nRet = TWAIN_SUCCESS;
// 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;
}
// Get the supported TWAIN version of the selected twain source
TWAIN_VERSION TwainVersion;
nRet = L_TwainGetVersion(&TwainVersion);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get twain version"), TEXT("ERROR"), MB_OK);
return nRet;
}
if(TwainVersion == TWAIN_VERSION1)
MessageBox (NULL, TEXT("Currently using TWAIN 1.x version"), TEXT("INFORMATION"), MB_OK | MB_ICONINFORMATION);
else
MessageBox (NULL, TEXT("Currently using TWAIN 2.x version"), TEXT("INFORMATION"), MB_OK | MB_ICONINFORMATION);
return nRet;
}