Cancels the current acquire operation.
#include "ltwrappr.h"
L_INT LTwain::CancelAcquire()
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Cancels the current acquire operation.
To cancel the acquire operation call this function inside the LTwain::AcquireCallBack or LTwain::BitmapCallBack callback functions.
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;
}