ISyncMgrControl::StartItemSync method

Initiates the synchronization of specified items managed by a particular handler.

Syntax


HRESULT StartItemSync(
  [in] LPCWSTR                    pszHandlerID,
  [in] LPCWSTR                    *ppszItemIDs,
  [in] DWORD                      cItems,
  [in] HWND                       hwndOwner,
  [in] IUnknown                   *punk,
  [in] SYNCMGR_SYNC_CONTROL_FLAGS nSyncControlFlags,
  [in] ISyncMgrSyncResult         *pResult
);

Parameters

pszHandlerID [in]

Type: LPCWSTR

A pointer to a buffer containing the unique ID of the handler that manages the items. This string is of maximum length MAX_SYNCMGR_ID including the terminating null character.

ppszItemIDs [in]

Type: LPCWSTR*

The address of a pointer to a buffer containing an array of IDs of the items to be synchronized. Each ID is of maximum length MAX_SYNCMGR_ID including the terminating null character. This array is passed to Synchronize.

cItems [in]

Type: DWORD

The number of IDs in ppszItemIDs.

hwndOwner [in]

Type: HWND

A handle to the window that the item can use to display any necessary UI. This value can be NULL.

punk [in]

Type: IUnknown*

A pointer to an IUnknown to be passed to Synchronize. This parameter can be NULL.

nSyncControlFlags [in]

Type: SYNCMGR_SYNC_CONTROL_FLAGS

A member of the SYNCMGR_SYNC_CONTROL_FLAGS enumeration that specifies whether an item found in both a current sync and a queued sync should be synchronized again when the queued sync is performed.

pResult [in]

Type: ISyncMgrSyncResult*

A pointer to an instance of ISyncMgrSyncResult, whose Result method is called when the synchronization ends, either through success, failure, or cancellation. The Result method is called with the aggregated state of the handler synchronization. This parameter can be NULL.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This method is analogous to UpdateItems.

Examples

The following example shows the usage of ISyncMgrControl::StartItemSync by a handler's procedure.


void CMyDeviceHandler::MiscProc(...)
{
    ...

    // Get the Sync Center control object.
    ISyncMgrControl *pControl = NULL;
    
    hr = CoCreateInstance(CLSID_SyncMgrControl, 
                          CLSCTX_SERVER,
                          IID_PPV_ARGS(&pControl));
    if (SUCCEEDED(hr))
    {
        // Synchronize one sync item for the sync handler.
        hr = pControl->StartItemSync(s_szMySyncHandlerID,
                                     s_szMySyncHandlerMusicContentID,
                                     1,
                                     _hwnd,
                                     NULL,
                                     NULL);
        pControl->Release();
    }

    ...

}


Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Syncmgr.h

IDL

Syncmgr.idl

 

 

Show: