// RasterThumbSink.cpp : implementation file // #include "stdafx.h" #include "demo.h" #include "RasterThumbSink.h" //#include "Demo.h" extern CDemoApp theApp; #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRasterThumbSink IMPLEMENT_DYNCREATE(CRasterThumbSink, CCmdTarget) CRasterThumbSink::CRasterThumbSink() { EnableAutomation(); } CRasterThumbSink::~CRasterThumbSink() { } void CRasterThumbSink::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(CRasterThumbSink, CCmdTarget) //{{AFX_MSG_MAP(CRasterThumbSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CRasterThumbSink, CCmdTarget) //{{AFX_DISPATCH_MAP(CRasterThumbSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_DISPATCH_MAP DISP_FUNCTION_ID(CRasterThumbSink, "ThumbnailEvent", 1, OnThumbnailEvent, VT_EMPTY, VTS_I4 VTS_BSTR VTS_I2 VTS_I2) END_DISPATCH_MAP() // Note: we add support for IID_IRasterThumbSink to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .ODL file. // {88921526-704F-11D5-860A-00104BDB8FF9} static const IID IID_IRasterThumbSink = { 0x88921526, 0x704f, 0x11d5, { 0x86, 0xa, 0x0, 0x10, 0x4b, 0xdb, 0x8f, 0xf9 } }; BEGIN_INTERFACE_MAP(CRasterThumbSink, CCmdTarget) INTERFACE_PART(CRasterThumbSink, DIID__LEADRasterThumbnailEvents, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterThumbSink message handlers void CRasterThumbSink::OnThumbnailEvent(long Bitmap, TCHAR * pszFilename, short StatusCode, short nPercent) { // theApp.m_pRasterThumbnail->ContinueBrowse = (StatusCode == 0? AfxMessageBox(pszFilename, MB_YESNO)==IDYES: TRUE); MSG msg; // are there any messages in the queue (like a key being pressed) ? while( PeekMessage(&msg,NULL, 0, 0, PM_REMOVE) ) { TranslateMessage( &msg ); /* Translates virtual key codes. */ DispatchMessage( &msg ); /* Dispatches message to window. */ } if(StatusCode == BROWSE_LOADING) //loading a file goto EVENTOUT; if(StatusCode == 0) theApp.m_pBrowseDlg->AddLEADListItem(pszFilename, Bitmap); EVENTOUT: if(((CMainFrame*)theApp.m_pMainWnd)->m_bBrowseQuit) theApp.m_pRasterThumbnail->ContinueBrowse = FALSE; else theApp.m_pRasterThumbnail->ContinueBrowse = TRUE; }