DTWAIN_AcquireNativeEx |
Top Previous Next |
The DTWAIN_AcquireNativeEx function starts the acquisition of images from a TWAIN Source using the Native Transfer mode.
DTWAIN_BOOL DTWAIN_AcquireNativeEx (
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_AcquireNativeEx is the same as DTWAIN_AcquireNative, 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_AcquireNativeEx 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.
Note that the image data is never destroyed by DTWAIN. The application is required to handle and destroy the image data.
Once DTWAIN_AcquireNativeEx 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_AcquireNativeEx, please see DTWAIN_AcquireNative.
Example:
void Test( ) { DTWAIN_ARRAY ImageArray; LONG nAcq; HANDLE hDib; LONG nNumImages; DTWAIN_SOURCE Source; //... ImageArray = DTWAIN_CreateAcquisitionArray( ); DTWAIN_AcquireNativeEx( 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 );
// Destroy the array and any image information DTWAIN_DestroyAcquisitionArray( ImageArray, TRUE ); }
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) DTWAIN_SelectSource or any DTWAIN Source selection function
See Also Acquiring Images |