DTWAIN_AcquireFileEx

Top  Previous  Next

The DTWAIN_AcquireFileEx starts the image acquisition from a Source and saves the image(s) to file or multiple files

 

DTWAIN_BOOL  DTWAIN_AcquireFileEx (

DTWAIN SOURCE

Source,

DTWAIN_ARRAY

FileNames,

LONG

FileType,

LONG

FileControlFlag,

LONG

PixelType,

LONG

NumPages,

DTWAIN_BOOL

bShowUI,

DTWAIN_BOOL

bCloseSource,

LPLONG

pStatus );

 

Parameters

Source

   Specifies a selected TWAIN Source.

 

FileNames

   A DTWAIN_ARRAY of type DTWAIN_ARRAYSTRING that contains a list of file names.

 

FileType

   Specifies the file format to save the acquired images.

 

FileControlFlag

   Specifies user interaction and which transfer mode to use.

 

PixelType

   Specifies the pixel type of the image

 

NumPages

   Specifies the number of pages to acquire.

 

bShowUI

  Specifies whether the Source displays the default User Interface.

 

bCloseSource

Specifies whether the Source should be automatically closed when the User Interface is closed.

 

pStatus

   NULL, or is the address of a variable that will be filled in with an error status value.

 

Return Values

If the function succeeds, TRUE is returned.  If the function fails FALSE is returned and pStatus is set to the error that occurred.  For more error information, call DTWAIN_GetLastError immediately after a failure occurs..

 

Comments

Starts the image acquisition from a TWAIN device and saves the acquired image(s) to a file or multiple files.  The arguments FileType, FileControlFlag, PixelType, Source, MaxPage, bShowUI, bCloseSource, and pStatus all have the same definitions as DTWAIN_AcquireFile.

 

DTWAIN_AcquireFileEx differs from DTWAIN_AcquireFile in that the list of file names are stored in a DTWAIN_ARRAY instead of a string of file names.  This allows file names with embedded spaces to be used.  Since DTWAIN_AcquireFile parses the file names using the space as a delimiter, DTWAIN_AcquireFile cannot be used if the file name contains spaces.  The FileNames argument must be a valid DTWAIN_ARRAY of type DTWAIN_ARRAYSTRING and must be initialized and destroyed by the application.  The number of items in the DTWAIN_ARRAY must be 1 or greater.

 

Example:

 

DTWAIN_SOURCE Source;

//... Assume Source is valid

// Create a DTWAIN_ARRAY that is initialized to hold two strings.

DTWAIN_ARRAY aFileNames = DTWAIN_ArrayCreate(DTWAIN_ARRAYSTRING, 2);

 

// Store filenames in the array

DTWAIN_ArraySetAtString( aFileNames, 0, "C:\Program Files\MyDibs\File1.BMP");

DTWAIN_ArraySetAtString( aFileNames, 1, "C:\Program Files\MyDibs\File2.BMP");

 

// Acquire to file

DTWAIN_AcquireFileEx( Source, aFileNames, /* Other arguments... */);

 

// Destroy array

DTWAIN_ArrayDestroy( aFileNames );

 

All other information concerning file acquisitions is equivalent to DTWAIN_AcquireFile.

 

TWAIN State Transitions

State 4(if Source is not opened)

State 5, 6, 7

State 4 (if Source is closed after acquisitions)

 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

DTWAIN Source Selection Function

 

See Also

Acquiring Images