#include "ltwia.h"
L_LTWIA_API L_INT EXT_FUNCTION L_WiaEnumFormats(hSession, pItem, uFlags, pfnCallBack, pUserData)
Enumerates all of the available WIA driver transfer formats.
Handle to an existing WIA session. This handle is obtained by calling the L_WiaInitSession function.
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.
Reserved for future use, pass 0.
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.
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.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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
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).
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;
}