// Userbtmp.cpp: implementation of the User Twain and Bitmap classs. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "TwainDemo.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif LEAD_START_CLASS_MAP(LUserBitmap,LBitmapBase) LEAD_INIT_LTwain(LUserTwain) LEAD_END_CLASS_MAP(LUserBitmap,LBitmapBase) LEAD_IMPLEMENTOBJECT(LUserBitmap); LEAD_IMPLEMENTOBJECT(LUserTwain); ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// LUserBitmap::LUserBitmap() { } LUserBitmap::~LUserBitmap() { } ////////////////////////////////////////////////////////////////////// // LUserTwain Class ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// LUserTwain::LUserTwain() { EnableCallBack(TRUE); m_nScanNo = 0; m_hFile = NULL; } LUserTwain::~LUserTwain() { } L_INT LUserTwain::BitmapCallBack(pBITMAPHANDLE pBitmap) { CTwainDemoApp * pTheApp = (CTwainDemoApp*)AfxGetApp(); if (pTheApp->m_twXferMech != TWSX_FILE) { LBitmapBase btmpBase; btmpBase.SetHandle(pBitmap); CString str; str.Format(TEXT("Twain Scan %d"),++m_nScanNo); pTheApp->CreateNewBitmapWindow(str, &btmpBase); } return SUCCESS; } L_INT LUserTwain::CapabilityCallBack(L_UINT uCap, pTW_CAPABILITY pCapability) { if (!m_hFile) return TWAIN_SUCCESS; if (!pCapability) return TWAIN_SUCCESS; CTwainDemoApp * pTheApp = (CTwainDemoApp*)AfxGetApp(); L_INT nRet = pTheApp->m_MyTwain.AddCapabilityToFile(m_hFile, pCapability); if (nRet != SUCCESS) { CString csError; csError.Format(TEXT("Error occurred during save capability to template file, nRet = %d"), nRet); pTheApp->AddErrorToErrorsList(csError); } return TWAIN_SUCCESS; }