DTWAIN_GetCurrentAcquiredImage

Top  Previous  Next

The DTWAIN_GetCurrentAcquiredImage function returns the handle to the last image that was acquired successfully.

 

HANDLE  DTWAIN_GetCurrentAcquiredImage ( DTWAIN_SOURCE Source )

 

Parameters

Source

The DTWAIN_SOURCE that is acquiring images.

 

Return Values

If the function succeeds, an image block is returned. If the function fails, NULL is returned.

 

Comments

DTWAIN_GetCurrentAcquiredImage returns a HANDLE to the last image that was acquired successfully.  You must use the Windows API GlobalLock on the return value to access the data.  At some point in your application, you must call the Windows API GlobalUnlock (if it was locked) and GlobalFree to destroy the data.

 

The returned HANDLE can be a Device Independent Bitmap, or if calling DTWAIN_AcquireBuffered using compression, a HANDLE to a series of bytes representing compressed image data (to get the number of bytes of compressed image data, use the Windows API GlobalSize function on the returned HANDLE, or call DTWAIN_GetCompressionSize function).

 

The DTWAIN_GetCurrentAcquiredImage function is useful if you are acquiring images and you desire to process each image as it is being acquired successfully.   For example, you may want to show the user a preview of the image that was last acquired so that you can query the user as to whether the image should be kept or discarded (see the DTWDEMO testbed program to see how this works).  The easiest way to do this is to use DTWAIN Notification Processing, capture DTWAIN_QUERYDISCARDPAGE and during the time the notification is being processed, call DTWAIN_GetCurrentAcquiredImage to retrieve the image data and display the image to the user.

 

 

TWAIN State Transitions

None

 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

DTWAIN Source Selection Function

DTWAIN Acquisition Function (DTWAIN_AcquireNative or DTWAIN_AcquireBuffered)

 

See Also

Acquiring Images