// RasterTwainSink.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "DemoDoc.h" #include "DemoView.h" #include "leadraster.h" #include "RasterTwainSink.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CDemoApp 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. //}}AFX_DISPATCH_MAP DISP_FUNCTION_ID(CRasterTwainSink, "AcquirePageEvent", 1, OnAcquire, VT_EMPTY, VTS_I4) DISP_FUNCTION_ID(CRasterTwainSink, "SaveTemplateEvent", 2, OnSaveTemplate, VT_EMPTY, VTS_UNKNOWN) DISP_FUNCTION_ID(CRasterTwainSink, "LoadTemplateEvent", 3, OnLoadTemplate, VT_EMPTY, VTS_UNKNOWN) END_DISPATCH_MAP() // Note: we add support for IID_IRasterTwainSink to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .ODL file. // {31406555-18F1-4970-8107-71C3D41C5BC7} static const IID IID_IRasterTwainSink = { 0x31406555, 0x18f1, 0x4970, { 0x81, 0x7, 0x71, 0xc3, 0xd4, 0x1c, 0x5b, 0xc7 } }; BEGIN_INTERFACE_MAP(CRasterTwainSink, CCmdTarget) INTERFACE_PART(CRasterTwainSink, DIID__LEADRasterTwainEvents, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterTwainSink message handlers void CRasterTwainSink::OnAcquire(long pBitmap) { if (theApp.m_pRaster->BitmapListCount > 0) theApp.m_pRaster->FreeList(); theApp.m_pRaster->InsertBitmapListItem(-1, pBitmap); theApp.OpenDocument(OPENMODE_TWAIN); } void CRasterTwainSink::OnSaveTemplate(IUnknown * pCapability) { } void CRasterTwainSink::OnLoadTemplate(IUnknown * pCapability) { }