L_WiaIsAvailable

Summary

Determines whether a WIA source is installed.

Syntax

#include "ltwia.h"

L_LTWIA_API L_BOOL EXT_FUNCTION L_WiaIsAvailable(uWiaVersion)

Parameters

L_UINT 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

Value Meaning
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

Platforms

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

Windows VISTA or later for WIA Version 2.

See Also

Functions

Topics

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 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS WIA C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.