// RasterTwainSink.cpp : implementation file // #include "stdafx.h" #include "barcode.h" #include "RasterTwainSink.h" #include "leadraster.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRasterTwainSink extern CBarCodeApp theApp; 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. afx_msg void OnAcquire(long pBitmap); afx_msg void OnSaveTemplate(IUnknown * pCapability); afx_msg void OnLoadTemplate(IUnknown * pCapability); 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) DISP_FUNCTION_ID(CRasterTwainSink, "AcquirePageEvent", 1, OnAcquire, VT_EMPTY, VTS_I4) 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. BEGIN_INTERFACE_MAP(CRasterTwainSink, CCmdTarget) INTERFACE_PART(CRasterTwainSink, DIID__LEADRasterTwainEvents, 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. if(pBitmap != 0) { CLEADRasterView * pRasterView = theApp.GetMainLead(); pRasterView->GetRaster().SetBitmap(pBitmap); } }