L_WiaIsAvailable

#include "ltwia.h"

L_LTWIA_API L_BOOL EXT_FUNCTION L_WiaIsAvailable(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 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.

Platforms

Earlier and later operating systems than Windows XP for WIA Version 1.

Windows VISTA or later for WIA Version 2.

See Also

Functions:

L_WiaAcquire, L_WiaAcquireToFile, L_WiaAcquireSimple.

Topics:

Programming with LEADTOOLS Windows Image Acquisition (WIA) Functions

 

WIA Functionality: Property Functions

Example

static L_INT CALLBACK WiaAcquireCB(HWIASESSION hSession, 
pBITMAPHANDLE pBitmap, 
L_TCHAR * pszFilename, 
L_UINT32 uPercent, 
L_UINT32 uFlags, 
L_VOID * pUserData) 
{ 
   UNREFERENCED_PARAMETER(hSession); 
   UNREFERENCED_PARAMETER(pBitmap); 
   UNREFERENCED_PARAMETER(pszFilename); 
   UNREFERENCED_PARAMETER(uPercent); 
   UNREFERENCED_PARAMETER(uFlags); 
   UNREFERENCED_PARAMETER(pUserData); 
   // You can do here any processing to the bitmap. 
   return WIA_SUCCESS; 
} 
L_INT WiaIsAvailableExample(HWND hWnd, L_UINT uWiaVersion) 
{ 
   L_BOOL bAvailable; 
   L_INT nRet; 
   HWIASESSION hSession = NULL; 
   LWIAACQUIREOPTIONS AcquireOpts; 
   /* Check to see if user passed WIA version is installed */ 
   bAvailable = L_WiaIsAvailable(uWiaVersion); 
   if (bAvailable) 
   { 
      nRet = L_WiaInitSession(uWiaVersion, &hSession); 
      if (nRet != SUCCESS) 
         return nRet; 
      nRet = L_WiaSelectDeviceDlg(hSession, hWnd, WiaDeviceTypeDefault, L_WIA_SELECT_DEVICE_NODEFAULT); 
      if (nRet != SUCCESS) 
      { 
         L_WiaEndSession(hSession); 
         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; 
      nRet = L_WiaAcquire(hSession, 
      hWnd, 
      L_WIA_SHOW_USER_INTERFACE|L_WIA_DEVICE_DIALOG_USE_COMMON_UI, 
      NULL, 
      &AcquireOpts, 
      NULL, 
      NULL, 
      WiaAcquireCB, 
      NULL); 
      if (nRet != SUCCESS) 
      { 
         L_WiaEndSession(hSession); 
         return nRet; 
      } 
      nRet = L_WiaEndSession(hSession); 
      if (nRet != SUCCESS) 
         return nRet; 
   } 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS WIA C API Help