// RasterScrSink.cpp : implementation file // #include "stdafx.h" #include "ScrDemo.h" #include "RasterScrSink.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CScrDemoApp theApp; ///////////////////////////////////////////////////////////////////////////// // CRasterScrSink IMPLEMENT_DYNCREATE(CRasterScrSink, CCmdTarget) CRasterScrSink::CRasterScrSink() { EnableAutomation(); } CRasterScrSink::~CRasterScrSink() { } void CRasterScrSink::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(CRasterScrSink, CCmdTarget) //{{AFX_MSG_MAP(CRasterScrSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CRasterScrSink, CCmdTarget) //{{AFX_DISPATCH_MAP(CRasterScrSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_DISPATCH_MAP DISP_FUNCTION_ID(CRasterScrSink, "CaptureImage", 1, OnCaptureImage, VT_EMPTY, VTS_I4) END_DISPATCH_MAP() // Note: we add support for IID_IRasterScrSink to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .ODL file. // {F60EDC80-793E-11D5-860A-00104BDB8FF9} static const IID IID_IRasterScrSink = { 0xf60edc80, 0x793e, 0x11d5, { 0x86, 0xa, 0x0, 0x10, 0x4b, 0xdb, 0x8f, 0xf9 } }; BEGIN_INTERFACE_MAP(CRasterScrSink, CCmdTarget) INTERFACE_PART(CRasterScrSink, DIID__LTSCREvents, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterScrSink message handlers void CRasterScrSink::OnCaptureImage(long CaptureNumber) { if(theApp.m_pRasterScr->GetBitmap()) theApp.CreateNewDoc(); }