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 or LTwain::FastAcquire, or when 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, LTwain::FastAcquire

Topics:

How to Acquire from the TWAIN Source

 

TWAIN Functionality: Property Functions

Example

class CMyTwainCA : public LTwain
{
public:
   L_INT BitmapCallBack(pBITMAPHANDLE pBitmap);
   HTWAINTEMPLATEFILE m_hFile;
};
L_INT CMyTwainCA::BitmapCallBack(pBITMAPHANDLE pBitmap)
{
   UNREFERENCED_PARAMETER(pBitmap);
   CancelAcquire();
   return SUCCESS;
}
// initialize session and call this function 
L_INT LTwain__CancelAcquireExample(pBITMAPHANDLE pBitmap, HWND hWnd) 
{
   L_INT             nRet;
   CMyTwainCA        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 nRet;
   }
   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);
      return nRet;
   }
   nRet = TwainSession.EndSession();
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}