// RasterTwainSink1.cpp : implementation file // #include "stdafx.h" #include "barcode.h" #include "RasterTwainSink1.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRasterTwainSink1 extern CBarCodeApp theApp; IMPLEMENT_DYNCREATE(CRasterTwainSink1, CCmdTarget) CRasterTwainSink1::CRasterTwainSink1() { EnableAutomation(); } CRasterTwainSink1::~CRasterTwainSink1() { } void CRasterTwainSink1::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. afx_msg void OnAcquire(long pBitmap); afx_msg void OnSaveTemplate(IUnknown * pCapability); afx_msg void OnLoadTemplate(IUnknown * pCapability); CCmdTarget::OnFinalRelease(); } BEGIN_MESSAGE_MAP(CRasterTwainSink1, CCmdTarget) //{{AFX_MSG_MAP(CRasterTwainSink1) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CRasterTwainSink1, CCmdTarget) DISP_FUNCTION_ID(CRasterTwainSink1, "AcquirePageEvent", 1, OnAcquire, VT_EMPTY, VTS_I4) DISP_FUNCTION_ID(CRasterTwainSink1, "SaveTemplateEvent", 2, OnSaveTemplate, VT_EMPTY, VTS_UNKNOWN) DISP_FUNCTION_ID(CRasterTwainSink1, "LoadTemplateEvent", 3, OnLoadTemplate, VT_EMPTY, VTS_UNKNOWN) END_DISPATCH_MAP() // Note: we add support for IID_IRasterTwainSink1 to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .ODL file. // {5966322D-8509-424F-9860-462FD3194D80} static const IID IID_IRasterTwainSink1 = { 0x5966322d, 0x8509, 0x424f, { 0x98, 0x60, 0x46, 0x2f, 0xd3, 0x19, 0x4d, 0x80 } }; BEGIN_INTERFACE_MAP(CRasterTwainSink1, CCmdTarget) INTERFACE_PART(CRasterTwainSink1, DIID__LEADRasterTwainEvents_D, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterTwainSink1 message handlers void CRasterTwainSink1::OnAcquire (long pBitmap) { //theApp.m_Bitmap = pBitmap; //store the bitmap because it will be freed after we return. if(pBitmap != 0) { CLead* pLead = theApp.GetMainLead(); pLead->SetBitmap(pBitmap); } } void CRasterTwainSink1::OnSaveTemplate(IUnknown * pCapability) { } void CRasterTwainSink1::OnLoadTemplate(IUnknown * pCapability) { }