// RasterTwainSink.cpp : implementation file // #include "stdafx.h" #include "MFCDEMO.H" #include "RESDEMO.H" #include "MFCDEDOC.H" #include "MFCDEVW.H" #include "RasterTwainSink.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CMfcdemoApp 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_D, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterTwainSink message handlers void CRasterTwainSink::OnAcquire (long pBitmap) { //theApp.m_Bitmap = pBitmap; //store the bitmap because it will be freed after we return. CLead* pLead = theApp.GetMainLead(); pLead->SetBitmap(pBitmap); } void CRasterTwainSink::OnSaveTemplate(IUnknown * pCapability) { } void CRasterTwainSink::OnLoadTemplate(IUnknown * pCapability) { }