LWIAACQUIRECALLBACK

#include "ltwia.h"

L_INT pEXT_CALLBACK YourFunction(hSession, pBitmap, pszFilename, uPercent, uFlags, pUserData)

Called for each image being acquired from the WIA source to the application. The address of this callback is passed as an argument in L_WiaAcquire and L_WiaAcquireSimple.

Parameters

HWIASESSION hSession

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

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle that references the bitmap acquired from the WIA source.

L_TCHAR * pszFilename

Character string containing the name of the file to which to save the scanned image(s). This parameter is valid only if the transfer mode is set to file transfer.

L_UINT32 uPercent

The percent completion of the page being scanned.

L_UINT32 uFlags

Flag that indicates the start or the end of the scanned page. Possible values are:

Value Meaning
0 Default value when this is not the first transferred chunk or the last transferred chunk.
L_WIA_ACQUIRE_START_OF_PAGE [0x00000001] Indicates the start of the page being scanned.
L_WIA_ACQUIRE_END_OF_PAGE [0x00000002] Indicates the end of the page being scanned. Use this value to reset the progress bar.

L_VOID * pUserData

A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of L_WiaAcquire or L_WiaAcquireSimple.)

Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

Value Meaning
SUCCESS The function was successful.
ERROR_USER_ABORT The callback wants to abort the scanning operation.
< 1 An error occurred. Refer to Return Codes.

Comments

This feature is available in version 16 or higher.

This callback will be called through the acquire process to provide the user with the percent completed of the process so he can update his progress bar and at the end it provides him/her with the bitmap handle after its prepared (if the user is doing memory transfer) and also passes the user the L_WIA_ACQUIRE_END_OF_PAGE flag in the uFlags parameter to indicate each end of page.

To prevent memory leaks, the user should free the bitmap within the callback function.

✎ NOTE

If you are using WIA 2.0 while the L_WIA_SHOW_USER_INTERFACE is set then no need to provide a callback pointer since Microsofts WIA 2.0 acquire dialog does not provide a callback and it does all the process and return back to you with the saved files count and paths.

Required DLLs and Libraries

Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

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