DTWAIN_AcquireBufferedEx
The DTWAIN_AcquireBufferedEx function starts the acquisition of images from a TWAIN Source using the Buffered (or memory) transfer mde.
DTWAIN_BOOL DTWAIN_AcquireBufferedEx (
Parameters Source Specifies a selected TWAIN Source.
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.
Acquisitions DTWAIN_ARRAY that will hold all the acquired image data.
pStatus Points to a variable that will be filled in with an error status value or NULL if no error status is desired.
Return Values If the function succeeds TRUE is returned. If an error has occurred, FALSE is returned.
Comments The DTWAIN_AcquireBufferedEx is the same as DTWAIN_AcquireBuffered, except that the image data is copied to the application supplied DTWAIN_ARRAY Acquisitions instead of being returned as a DTWAIN_ARRAY.
The advantage of this function is that Acquisitions will have all the image data that has been acquired for the entire session that the Source is acquiring images. Your application does not have to wait for DTWAIN_AcquireBufferedEx to return to obtain the image information. The DTWAIN_ARRAY Acquisitions must have been previously created with DTWAIN_CreateAcquisitionArray, and it must be destroyed when no longer used by DTWAIN_DestroyAcquisitionArray.
Once DTWAIN_AcquireBufferedEx returns successfully, the image data can be retrieved using the Image retrieval functions such as DTWAIN_GetAcquiredImage, DTWAIN_GetAcquiredImageArray, etc.
To get information on the other parameters to DTWAIN_AcquireBufferedEx, please see DTWAIN_AcquireBuffered.
Example:
void Test( ) { DTWAIN_ARRAY ImageArray; LONG nAcq; HANDLE hDib; LONG nNumImages; DTWAIN_SOURCE Source; //... ImageArray = DTWAIN_CreateAcquisitionArray( ); DTWAIN_AcquireBufferedEx( Source, DTWAIN_PT_DEFAULT, 1, TRUE, TRUE, TRUE, ImageArray, NULL); //.. // Get the number of acquisitions nAcq = DTWAIN_ArrayGetCount( ImageArray );
// Get the array of DIB image data acquired in the first acquisition sesson nNumImages = DTWAIN_GetAcquiredImageArray( ImageArray, 0 );
// Get the DIB data of page 1, acquisition 1 hDib = DTWAIN_GetAcquiredImage( ImageArray, 0, 0 ); }
TWAIN State Transitions State 4 (if Source is not already opened) State 4 (if Source is closed after UI is closed)
Prerequisite Function Call(s)
See Also Acquiring Images
|