ISyncMgrControl::StartItemSync method (syncmgr.h)

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

Syntax

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

Parameters

[in] pszHandlerID

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.

[in] ppszItemIDs

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.

[in] cItems

Type: DWORD

The number of IDs in ppszItemIDs.

[in] hwndOwner

Type: HWND

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

[in] punk

Type: IUnknown*

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

[in] nSyncControlFlags

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.

[in] pResult

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

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header syncmgr.h