#include "ltwia.h"
L_LTWIA_API L_INT EXT_FUNCTION L_WiaEnumCapabilities(hSession, pItem, uFlags, pfnCallBack, pUserData)
Enumerates all of the available WIA driver capabilities and properties and determines the available values for each one.
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 capability was received from the driver. It provides the user with information about each enumerated property such as the valid ranges and values for each of the WIA device properties. It also allows the user to abort the enumeration process.
The callback function must adhere to the function prototype described in LWIAENUMCAPABILITIESCALLBACK 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 capabilities and properties (and determine the available values for each one) for the specified acquisition source.
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 WiaEnumCapsCB(HWIASESSION hSession,
L_INT nCapsCount,
pLWIACAPABILITY pCapability,
L_VOID * pUserData)
{
UNREFERENCED_PARAMETER(hSession);
UNREFERENCED_PARAMETER(nCapsCount);
UNREFERENCED_PARAMETER(pCapability);
UNREFERENCED_PARAMETER(pUserData);
// You can do here any kind of checking or handling to the received capability.
return WIA_SUCCESS;
}
L_INT WiaEnumCapabilitiesExample(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_WiaEnumCapabilities(hSession, pRootItem, 0, WiaEnumCapsCB, NULL);
if (nRet != WIA_SUCCESS)
return FALSE;
return SUCCESS;
}