Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
LWia::Acquire
#include "ltwrappr.h"
virtual L_INT LWia::Acquire(uFlags, pSourceItem, pAcquireOptions, pnFilesCount, pppszFilePaths)
L_UINT32 uFlags; |
/* optional flags */ |
L_VOID * pSourceItem; |
/* scanner device paper source */ |
pLWIAACQUIREOPTIONS pAcquireOptions; |
/* pointer to an optional acquire options structure */ |
L_INT * pnFilesCount; |
/* optional pointer to a variable */ |
L_TCHAR *** pppszFilePaths; |
/* optional pointer to a string buffer */ |
Acquires one or more images from a WIA source.
Parameter |
Description |
|
uFlags |
Flag that determines certain actions of the WIA image acquisition selection dialog box. Possible values are: |
|
|
Value |
Meaning |
|
0 |
Default behavior for the device image acquisition dialog box. |
|
L_WIA_DEVICE_DIALOG_SINGLE_IMAGE |
[0x00000002] Restrict image selection to a single image in the device image acquisition dialog box. This flag is not available if you are using WIA version 2.0. |
|
L_WIA_SHOW_USER_INTERFACE |
[0x00000003] Show the manufacturer's image acquisition dialog box. |
|
L_WIA_DEVICE_DIALOG_USE_COMMON_UI |
[0x00000004] Use the system user interface (UI), if available, rather than the vendor-supplied UI. If the system UI is not available, the vendor UI is used. |
pSourceItem |
This parameter only takes place if you are acquiring from scanner device and while the L_WIA_SHOW_USER_INTERFACE flag is NOT set, through this parameter you can specify the scanner's paper source (Feeder or Flatbed). |
|
|
This flag is optional, since if you are using WIA 1.0 then you can change the paper source by changing the WIA_DPS_DOCUMENT_HANDLING_SELECT property for the root item or by enumerating the available scanner items and pass the item you wish to scan from. |
|
|
If you are using WIA 2.0 then you have to enumerate the available scanner items and pass the item you wish to scan from or you can pass NULL and in this case the enumeration will be done internally and the first enumerated item will be used as the source item. |
|
pAcquireOptions |
Pointer to an optional acquires options structure that contains information the user can use to control the acquisition behavior from the WIA device. |
|
|
If the user passed NULL for this parameter, internal default values will be used. |
|
pnFilesCount |
Pointer to a variable of type L_INT to be updated with the number of the saved files when acquire using File mode. |
|
pppszFilePaths |
Pointer to string buffer to hold an array of the saved file paths. Used when the transfer mode is file. |
|
|
You can define a variable of type L_TCHAR*** of size zero and pass the address of that variable to the acquire function. |
|
|
It is the user's responsibility to free the received file name array. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
This feature is available in LEADTOOLS version 16 or higher.
This function will acquire single or multiple images from the selected WIA device.
Make sure to call LWia::InitSession and then call any of the LWia::SelectDeviceDlg or LWia::SelectDevice functions before calling this function.
You can specify the parent window for the image acquisition dialog by calling the LScanner::SetWindow function.
When performing memory transfer you need to override the LWia::AcquireCallBack function in order to receive the acquired page(s) through the pBitmap parameter of this callback. The callback will also provide you with the percent completion of the page transfer progress.
When performing file transfer it is optional to override the LWia::AcquireCallBack function since the callback will only provide you with the saved file path and the percent completion of the file save process.
To cancel the acquire operation you need to override the LWia::AcquireCallBack function and return ERROR_USER_ABORT error code.
Note: |
If the user set the L_WIA_SHOW_USER_INTERFACE flag, then he should be aware of the following point: |
|
Some of the previously set/changed user properties using any of the LWia::SetPropertyXXX or LWia::SetProperties functions will be overwritten by the Microsoft image acquisition dialog box, since this dialog set it seems that this dialog sets it's own initialization properties like the current intent (image type), selected area (left, top, width and height), papser 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: |
While running a Win32 version application that calls this function while specifying the pnFilesCount and pppszFilePaths parameters on Windows VISTA 64-Bit we have noticed that these two members will not be filled back with the required information and this is a known limitation from Microsoft's WIA toolkit side. |
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. |
See Also
Functions: |
LWia::AcquireToFile, LWia::AcquireSimple, LWia::InitSession, LWia::EndSession, Class Members |
Topics: |
|
|
Example
For an example, refer to LWia::IsAvailable.