// RasterTwainSink.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "RasteTwainSink.h" #include "FASTTWNDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRasterTwainSink IMPLEMENT_DYNCREATE(CRasterTwainSink, CCmdTarget) CRasterTwainSink::CRasterTwainSink() { EnableAutomation(); } CRasterTwainSink::~CRasterTwainSink() { } void CRasterTwainSink::OnFinalRelease() { // When the last reference for an automation object is released // OnFinalRelease is called. The base class will automatically // deletes the object. Add additional cleanup required for your // object before calling the base class. CCmdTarget::OnFinalRelease(); } BEGIN_MESSAGE_MAP(CRasterTwainSink, CCmdTarget) //{{AFX_MSG_MAP(CRasterTwainSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CRasterTwainSink, CCmdTarget) //{{AFX_DISPATCH_MAP(CRasterTwainSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_DISPATCH_MAP DISP_FUNCTION_ID(CRasterTwainSink, "AcquirePageEvent", 1, OnAcquire, VT_EMPTY, VTS_I4) END_DISPATCH_MAP() BEGIN_INTERFACE_MAP(CRasterTwainSink, CCmdTarget) INTERFACE_PART(CRasterTwainSink, DIID__LEADRasterTwainEvents, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterTwainSink message handlers void CRasterTwainSink::OnAcquire (long pBitmap) { CString csFName; m_pDlg->m_nPageCount++; m_pDlg->GetMultiFileName(csFName); BSTR bstrName = csFName.AllocSysString(); short iRet = m_pDlg->m_pltRaster->InsertBitmapListItem(0, pBitmap); m_pDlg->m_pltRasterIO->Save(m_pDlg->m_pltRaster, bstrName, (RasterFileConstants)m_pDlg->m_nSaveFormat, m_pDlg->m_nSaveBPP, (QFactorConstants)m_pDlg->m_nSaveQFactor, SAVE_APPEND); SysFreeString(bstrName); }