Determines whether a TWAIN source is installed.
#include "ltwrappr.h"
virtual L_BOOL LTwain::IsAvailable()
Value | Meaning |
---|---|
TRUE | At least one TWAIN source is installed. |
FALSE | No TWAIN source is installed. |
You can use this function when deciding whether to enable or disable TWAIN menu items.
L_INT LTwain__IsAvailableExample(HWND hWnd, HBITMAPLIST hBitmap)
{
L_BOOL bAvailable;
L_INT nRet;
LTwain MyClass;
APPLICATIONDATA AppData;
/* Check to see if TWAIN is installed */
bAvailable = MyClass.IsAvailable();
if (bAvailable)
{
AppData.hWnd = hWnd;
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;
nRet = MyClass.AcquireList(hBitmap, NULL, LTWAIN_SHOW_USER_INTERFACE);
if(nRet != SUCCESS)
return nRet;
nRet = MyClass.EndSession();
if(nRet != SUCCESS)
return nRet;
}
return SUCCESS;
}