home *** CD-ROM | disk | FTP | other *** search
- #include "stdafx.h"
-
- /*
- * Xceed Backup Library - AddIn Sample: Event Sink
- * Copyright 1999, Xceed Software Inc.
- *
- * Description:
- * The class CBackupEvents implements the event sink for Xceed Backup Library.
- * It derives from ATL template IDispEventSimpleImpl, which provides the dispatch
- * interface to the connection point container and calls the proper methods for
- * incoming events based on the SINK_MAP.
- *
- */
-
- void _stdcall CBackupEvents::BackupFileExpired( BSTR sBackupFilename, BSTR sBackupSetName,
- enum bkpBackupType xBackupType,
- DATE dtBackupDate, DATE dtExpirationDate,
- VARIANT_BOOL bLatestOfThisType,
- VARIANT_BOOL * bKeepBackup )
- {
- *bKeepBackup = bLatestOfThisType;
- }
-
- void _stdcall CBackupEvents::BeforeBackingUpFile( BSTR sFilename, long lSize,
- enum bkpFileAttributes xAttributes,
- DATE dtLastModified, DATE dtLastAccessed,
- DATE dtCreated, long lDiskNumber )
- {
- if( m_spApplication )
- {
- try
- {
- CComBSTR bstrOutputString( " Backing up file " );
- bstrOutputString += sFilename;
-
- m_spApplication->PrintToOutputWindow( bstrOutputString );
- }
- catch( ... )
- {
- }
- }
- }
-
- void _stdcall CBackupEvents::ProcessCompleted( long lFilesTotal, long lFilesProcessed,
- long lFilesSkipped, long lBytesTotal,
- long lBytesProcessed, long lBytesSkipped,
- enum bkpError xResult )
- {
- if( m_spApplication )
- {
- try
- {
- CComBSTR bstrOutputString( "Backup completed." );
-
- if( m_piXceedBackup )
- {
- CComBSTR bstrResult;
-
- bstrResult = m_piXceedBackup->GetErrorDescription( bvtError, xResult );
-
- bstrOutputString += " Result: ";
- bstrOutputString += bstrResult;
- }
-
- m_spApplication->PrintToOutputWindow( bstrOutputString );
- }
- catch( ... )
- {
- }
- }
- }
-
- void _stdcall CBackupEvents::SkippingFile( BSTR sFilename, long lSize,
- enum bkpFileAttributes xAttributes,
- DATE dtLastModified, DATE dtLastAccessed,
- DATE dtCreated, enum bkpSkippingReason xSkippingReason )
- {
- if( m_spApplication )
- {
- try
- {
- CComBSTR bstrOutputString( " Skipping file " );
- bstrOutputString += sFilename;
-
- if( m_piXceedBackup )
- {
- CComBSTR bstrReason;
-
- bstrReason = m_piXceedBackup->GetErrorDescription( bvtSkippingReason, xSkippingReason );
-
- bstrOutputString += " Reason: ";
- bstrOutputString += bstrReason;
- }
-
- m_spApplication->PrintToOutputWindow( bstrOutputString );
- }
- catch( ... )
- {
- }
- }
- }
-
- void _stdcall CBackupEvents::StartingBackup( struct IXceedBackupJob * xBackupJob,
- DATE dtBackupDate, BSTR * sMediaLabelPattern,
- VARIANT_BOOL * bPreventLaunch )
- {
- if( m_spApplication )
- {
- try
- {
- CComBSTR bstrProjectName;
-
- if( SUCCEEDED( xBackupJob->get_BackupSetName( &bstrProjectName ) ) )
- {
- CComBSTR bstrOutputString( "\nStarting backup of the files for the project " );
- bstrOutputString += bstrProjectName;
-
- m_spApplication->PrintToOutputWindow( bstrOutputString );
- }
- }
- catch( ... )
- {
- }
- }
- }
-
- //
- // END_OF_FILE
- //
-