LWia::IsAvailable

#include "ltwrappr.h"

virtual L_BOOL LWia::IsAvailable(uWiaVersion)

L_UINT uWiaVersion;

/* WIA version you wish to use */

Determines whether a WIA source is installed.

Parameter

Description

uWiaVersion

The WIA version to be used. Possible values are:

 

Value

Meaning

 

WiaVersion1

[1] Use WIA version 1.

 

WiaVersion2

[2] Use WIA version 2.

Returns

TRUE

At least one WIA source is installed.

FALSE

No WIA source is installed.

Comments

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

LTWIA

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LWia::Acquire, LWia::AcquireToFile, LWia::AcquireSimple, Class Members

Topics:

Programming with LEADTOOLS Windows Image Acquisition (WIA) Functions

 

WIA Functionality: Property Functions

Example

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_LTWIASAM_CLIB 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;
}