// RasterTwainSink.cpp : implementation file // #include "stdafx.h" #include "msvc5ocr.h" #include "MSVC5OCRDoc.h" #include "MSVC5OCRView.h" #include "RasterTwainSink.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CMSVC5OCRView theApp; ///////////////////////////////////////////////////////////////////////////// // 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. DISP_FUNCTION_ID(CRasterTwainSink, "AcquirePageEvent", 1, OnAcquire, VT_EMPTY, VTS_I4) //}}AFX_DISPATCH_MAP 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) { CMSVC5OCRApp * pTheApp = (CMSVC5OCRApp *)AfxGetApp(); pTheApp->m_pRaster->PutBitmap(0); pTheApp->m_pRaster->PutBitmap(pBitmap); pTheApp->m_nPageMode = NEW_PAGE_FROM_TWAIN; pTheApp->AddTwainImage(); }