ISyncMgrSyncCallback::CanContinue method

Determines whether the synchronization has been canceled.

Syntax


HRESULT CanContinue(
  [in]  LPCWSTR pszItemID
);

Parameters

pszItemID [in]

Type: LPCWSTR

A pointer to a buffer containing the ID of the item.

Return value

Type: HRESULT

Return ValueMeaning
S_OKA cancellation has not been requested. The synchronization can continue.
S_FALSEA cancellation has been requested. The handler should call ISyncMgrSyncCallback::ReportProgress, specifying SYNCMGR_PS_CANCELED in the nStatus parameter.
E_INVALIDARGThe value pointed to by pszItemID is either unknown to Sync Center or is not an item managed by this handler.

 

If pszItemID is NULL or an empty string, the return value depends on whether a cancellation has been requested for the entire handler.

Remarks

A synchronization can be canceled by the user by clicking the Stop or Stop All task on the context menu or the command module. It can also be canceled when an application calls one of the stop methods of the ISyncMgrControl interface.

By implementing this functionality as a separate method, the handler can check for a cancellation without reporting progress.

Examples

The following example shows the usage of ISyncMgrSyncCallback::CanContinue by the Synchronize method.


HRESULT CMyDeviceHandler::Synchronize(...)
{
    ...

    // Start synchronizing the sync items.

    ...

    // If a cancellation has been requested, stop the sync and exit.
    if (pCallback->CanContinue(pszItemID) == S_FALSE)
    {
        // End the sync operation and exit the function.
        hr = pCallback->ReportProgress(pszItemID,
                                       pszCancelMessage,
                                       SYNCMGR_PS_CANCELED,
                                       uCurrentStep,
                                       uMaxStep,
                                       NULL);
    }
    ...
}


Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Syncmgr.h

IDL

Syncmgr.idl

 

 

Community Additions

ADD
Show:
© 2014 Microsoft