// RasterProcSink.cpp : implementation file // #include "stdafx.h" #include "RasterProcSink.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CRGSMRKApp theApp; ///////////////////////////////////////////////////////////////////////////// // CRasterProcSink IMPLEMENT_DYNCREATE(CRasterProcSink, CCmdTarget) CRasterProcSink::CRasterProcSink() { EnableAutomation(); } CRasterProcSink::~CRasterProcSink() { } void CRasterProcSink::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(CRasterProcSink, CCmdTarget) //{{AFX_MSG_MAP(CRasterProcSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CRasterProcSink, CCmdTarget) //{{AFX_DISPATCH_MAP(CRasterProcSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_DISPATCH_MAP DISP_FUNCTION_ID(CRasterProcSink,"ProgressStatus",1,OnProgressStatus,VT_I2,VTS_I2) END_DISPATCH_MAP() // Note: we add support for IID_IRasterProcSink to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .ODL file. // {FCEC20F1-6B67-4CFC-A652-C2ABCCFC8A8C} static const IID IID_IRasterProcSink = { 0xfcec20f1, 0x6b67, 0x4cfc, { 0xa6, 0x52, 0xc2, 0xab, 0xcc, 0xfc, 0x8a, 0x8c } }; BEGIN_INTERFACE_MAP(CRasterProcSink, CCmdTarget) INTERFACE_PART(CRasterProcSink, DIID__LEADRasterProcessEvents, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterProcSink message handlers int CRasterProcSink::OnProgressStatus(short iPercent) { CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd(); if (!pFrame) return 0; BeginWaitCursor(); pFrame->m_ProgressBar.SetPos( iPercent ); if (iPercent == 100) { pFrame->m_ProgressBar.SetPos(0); pFrame->m_wndStatusBar.SetPaneText( 1, TEXT(""), TRUE); } EndWaitCursor(); return 0; }