L_WiaEnumFormats

#include "ltwia.h"

L_LTWIA_API L_INT EXT_FUNCTION L_WiaEnumFormats(hSession, pItem, uFlags, pfnCallBack, pUserData)

HWIASESSION hSession;

handle to an existing WIA session

L_VOID* pItem;

pointer to IWiaItem or IWiaItem2 interface

L_UINT uFlags;

reserved for future use, pass 0

LWIAENUMFORMATSCALLBACK pfnCallBack;

pointer to callback function

L_VOID * pUserData;

pointer to additional parameters

Enumerates all of the available WIA driver transfer formats.

Parameter

Description

hSession

Handle to an existing WIA session. This handle is obtained by calling the L_WiaInitSession function.

pItem

Valid pointer to a type IWiaItem or IWiaItem2 object (IWiaItem if using WIA Version 1.0; IWiaItem2 if using WIA Version 2.0), which represents the item being enumerated.

 

You can retrieve this parameter by either calling the L_WiaGetRootItem function to get a pointer to the device's root item or by enumerating the child items of the device through a call to L_WiaEnumChildItems.

uFlags

Reserved for future use, pass 0.

pfnCallBack

Pointer to a callback function, called as each format is received from the driver along with the transfer mode this format is associated with. It also allows the user to abort the enumeration process.

 

The callback function must adhere to the function prototype described in LWIAENUMFORMATSCALLBACK function.

pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.

 

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.

 

If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This feature is available in version 16 or higher.

This function will enumerate all of the available WIA driver transfer formats for the specified acquisition source item.

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

LEADTOOLS WIA supports both 32-bit and 64-bit image acquisition for both WIA 1.0 (XP and earlier) and WIA 2.0 (VISTA and later).

See Also

Functions:

L_WiaEnumCapabilities, L_WiaInitSession, L_WiaEndSession, LWIAENUMFORMATSCALLBACK.

Topics:

Managing WIA Sources

 

WIA Functionality: Property Functions

 

WIA Functionality: Callbacks

Example

static L_INT CALLBACK WiaEnumFormatsCB(HWIASESSION hSession, 
L_INT nFormatsCount, 
L_INT nTransferMode, 
GUID * pFormat, 
L_VOID * pUserData) 
{ 
   UNREFERENCED_PARAMETER(hSession); 
   UNREFERENCED_PARAMETER(nFormatsCount); 
   UNREFERENCED_PARAMETER(nTransferMode); 
   UNREFERENCED_PARAMETER(pFormat); 
   UNREFERENCED_PARAMETER(pUserData); 
   // You can do here any kind of checking or handling to the received format. 
   return WIA_SUCCESS; 
} 
L_INT WiaEnumFormatsExample(HWIASESSION hSession) 
{ 
   IWiaItem * pRootItem = NULL; 
   L_INT nRet; 
   /* Get a pointer to the WIA device's root items */ 
   nRet = L_WiaGetRootItem(hSession, NULL, (L_VOID**)&pRootItem); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_WiaEnumFormats(hSession, pRootItem, 0, WiaEnumFormatsCB, NULL); 
   if (nRet != WIA_SUCCESS) 
      return FALSE; 
   return SUCCESS; 
} 

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