LTwain::CancelAcquire

Summary

Cancels the current acquire operation.

Syntax

#include "ltwrappr.h"

L_INT LTwain::CancelAcquire()

Returns

Value Meaning
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 or LTwain::BitmapCallBack callback functions.

Required DLLs and Libraries

See Also

Functions

Topics

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; 
 
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.