#include "ltwrappr.h"
virtual L_BOOL LWia::IsAvailable(uWiaVersion)
Determines whether a WIA source is installed.
The WIA version to be used. Possible values are:
Value | Meaning |
---|---|
WiaVersion1 | [1] Use WIA version 1. |
WiaVersion2 | [2] Use WIA version 2. |
Value | Meaning |
---|---|
TRUE | At least one WIA source is installed. |
FALSE | No WIA source is installed. |
This feature is available in LEADTOOLS version 16 or higher.
Use this function when deciding whether to enable or disable WIA menu items.
Required DLLs and Libraries
Platforms
Earlier and later operating systems than Windows XP for WIA Version 1.
Windows VISTA or later for WIA Version 2.
class CMyWIA : public LWia
{
public:
L_INT AcquireCallBack(pBITMAPHANDLE pBitmap, L_TCHAR * pszFilename, L_UINT32 uPercent, L_UINT32 uFlags);
};
L_INT CMyWIA::AcquireCallBack(pBITMAPHANDLE pBitmap, L_TCHAR * pszFilename, L_UINT32 uPercent, L_UINT32 uFlags)
{
UNREFERENCED_PARAMETER(pBitmap);
UNREFERENCED_PARAMETER(pszFilename);
UNREFERENCED_PARAMETER(uPercent);
UNREFERENCED_PARAMETER(uFlags);
// You can do here any processing to the bitmap
return WIA_SUCCESS;
}
L_INT LWIA__IsAvailableExample(L_UINT uWiaVersion)
{
CMyWIA MyClass;
LWIAACQUIREOPTIONS AcquireOpts;
L_BOOL bAvailable;
L_INT nRet;
/* Check to see if user passed WIA version is installed */
bAvailable = MyClass.IsAvailable(uWiaVersion);
if (bAvailable)
{
nRet = MyClass.InitSession(uWiaVersion);
if (nRet != SUCCESS)
return nRet;
nRet = MyClass.SelectDeviceDlg(WiaDeviceTypeDefault, L_WIA_SELECT_DEVICE_NODEFAULT);
if (nRet != SUCCESS)
return nRet;
/* Initialize and fill the required fields from the LWIAACQUIREOPTIONS structure */
memset(&AcquireOpts, 0, sizeof(LWIAACQUIREOPTIONS));
AcquireOpts.uStructSize = sizeof(LWIAACQUIREOPTIONS);
AcquireOpts.uMemBufSize = 64 * 1024;
AcquireOpts.bDoubleBuffer = TRUE;
MyClass.EnableCallBack (TRUE);
nRet = MyClass.Acquire(L_WIA_DEVICE_DIALOG_USE_COMMON_UI,
&AcquireOpts,
NULL,
NULL,
NULL);
if (nRet != SUCCESS)
return nRet;
nRet = MyClass.EndSession();
if (nRet != SUCCESS)
return nRet;
}
return SUCCESS;
}