L_WiaSetProperties

#include "ltwia.h"

L_LTWIA_API L_INT EXT_FUNCTION L_WiaSetProperties(hSession, pItem, pProperties, pfnCallBack, pUserData)

HWIASESSION hSession;

/* handle to an existing WIA session */

L_VOID* pItem;

/* pointer to IWiaItem or IWiaItem2 interface */

pLWIAPROPERTIES pProperties;

/* pointer to a structure */

LWIASETPROPERTIESCALLBACK pfnCallBack;

/* pointer to callback function */

L_VOID * pUserData;

/* pointer to additional parameters */

Sets a list of all properties available through the LWIAPROPERTIES structure into the WIA device's item passed through the pItem parameter.

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 that is having its properties set.

 

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.

pProperties

Pointer to a structure of type LWIAPROPERTIES retrieved through the call to the L_WiaGetProperties function.

pfnCallBack

Optional callback function. It is called as each property is set. It lets the user know if an error occurred during the set operation and lets the user abort or retry by returning WIA_ABORT or WIA_RETRY.

 

If you do not provide a callback function, use NULL as the value of this parameter. No error reporting will occur.

 

If you do provide a callback function, use the function pointer as the value of this parameter.

 

The callback function must adhere to the function prototype described in LWIASETPROPERTIESCALLBACK 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.

The function can set the values of the properties to the values specified in the LWIAPROPERTIES structure into the WIA device's item passed through the pItem parameter.

Note:

If the user set the L_WIA_SHOW_USER_INTERFACE flag, then he should be aware of the following point:

 

Some of the these properties will be overwritten by the Microsoft image acquisition dialog box, like the current intent (image type), selected area (left, top, width and height), paper source and duplex mode, etc.

So if the user wants to keep his changed properties then he should not set this flag to suppress the manufacturer's image acquisition dialog and acquire directly from the specified source item.

 

Note:

Through our test we have found the following limitation related to the Microsoft WIA toolkit: On some drivers, while using WIA 2.0, if you want to change the Image Data Type property (WIA_IPA_DATATYPE) to a custom setting then you have to set the WIA_IPS_CUR_INTENT property value to WIA_INTENT_NONE.

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_WiaGetProperties, L_WiaGetRootItem, L_WiaEnumChildItems, L_WiaInitSession, L_WiaEndSession, LWIASETPROPERTIESCALLBACK.

Topics:

Managing WIA Sources

 

WIA Functionality: Property Functions

 

WIA Functionality: Callbacks

Example

For an example, refer to L_WiaGetRootItem.