LTwain::CancelAcquire

#include "ltwrappr.h"

L_INT LTwain::CancelAcquire()

Cancels the current acquire operation.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Cancels the current acquire operation.

To cancel the acquire operation call this function inside the LTwain::AcquireCallBack which is called by the LTwain::AcquireMulti function, or call this function inside the LTwain::BitmapCallBack which is called by the LTwain::Acquire function.

Required DLLs and Libraries

LTTWN

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:

LTwain::Acquire, LTwain::AcquireMulti

Topics:

How to Acquire from the TWAIN Source

 

TWAIN Functionality: Property Functions

Example

class CMyTwain : public LTwain
{
public:
   L_INT BitmapCallBack(pBITMAPHANDLE pBitmap);

   HTWAINTEMPLATEFILE m_hFile;
};

L_INT CMyTwain::BitmapCallBack(pBITMAPHANDLE pBitmap)
{
   CancelAcquire();
   return SUCCESS;
}

// initialize session and call this function 
void TwainAcquire (pBITMAPHANDLE pBitmap, HWND hWnd) 
{
   L_INT nRet; 
   CMyTwain TwainSession;
   APPLICATIONDATA AppData;

   memset(&AppData, 0, sizeof(APPLICATIONDATA));

   AppData.hWnd = hWnd; 
   AppData.uStructSize = sizeof(AppData);
   lstrcpy (AppData.szManufacturerName, _T("LEAD Technologies, Inc.")); 
   lstrcpy (AppData.szAppProductFamily, _T("LEAD Test Applications"));
   lstrcpy (AppData.szVersionInfo, _T("Version 1.0"));
   lstrcpy (AppData.szAppName, _T("TWAIN Test Application"));
   nRet = TwainSession.InitSession(&AppData); 
   if (nRet != TWAIN_SUCCESS)
   {
      MessageBox(hWnd, TEXT("Error occurred during call InitSession"), TEXT("Notice"), MB_OK);
      return;
   }

   TwainSession.EnableCallBack (TRUE);

   nRet = TwainSession.Acquire(pBitmap, sizeof(BITMAPHANDLE), LTWAIN_SHOW_USER_INTERFACE, NULL); 
   if (nRet == SUCCESS)
      MessageBox(NULL, TEXT("The image acquisition process completed."), TEXT("Notice"), MB_OK);
   else
      MessageBox(NULL, TEXT(" The image acquisition process failed!"), TEXT("Error"), MB_OK);

   TwainSession.EndSession();
}