ISyncMgrControl::EnableItem method (syncmgr.h)

Enables or disables a sync item managed by a specified handler.

Syntax

HRESULT EnableItem(
  [in] BOOL                  fEnable,
  [in] LPCWSTR               pszHandlerID,
  [in] LPCWSTR               pszItemID,
  [in] HWND                  hwndOwner,
  [in] SYNCMGR_CONTROL_FLAGS nControlFlags
);

Parameters

[in] fEnable

Type: BOOL

TRUE to enable; FALSE to disable.

[in] pszHandlerID

Type: LPCWSTR

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

[in] pszItemID

Type: LPCWSTR

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

[in] hwndOwner

Type: HWND

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

[in] nControlFlags

Type: SYNCMGR_CONTROL_FLAGS

A value from the SYNCMGR_CONTROL_FLAGS enumeration specifying whether the enabling or disabling of the item should be performed synchronously or asynchronously.

Return value

Type: HRESULT

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

Remarks

An enabled item is an item that can be synchronized.

If the specified item returns SYNCMGR_ICM_QUERY_BEFORE_ENABLE or SYNCMGR_ICM_QUERY_BEFORE_DISABLE in the mask returned from the GetCapabilities method, the user is presented with a confirmation dialog box requested before the item is enabled or disabled. If no query UI is requested or once the user confirms the operation, the item's Enable method is called.

If SYNCMGR_CF_WAIT is set in the nControlFlags parameter, EnableItem does not return until Sync Center has processed this notification.

Examples

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

void MiscProc(...)
{
    ...

    // Get the Sync Center control object.
    ISyncMgrControl *pControl = NULL;
    
    hr = CoCreateInstance(CLSID_SyncMgrControl, 
                          CLSCTX_SERVER, 
                          IID_PPV_ARGS(&pControl));
    if (SUCCEEDED(hr))
    {
        // Tell Sync Center to disable the item.
        hr = pControl->EnableItem(FALSE, 
                                  s_szMySyncHandlerID,
                                  s_szMySyncHandlerMusicContentID, 
                                  hwnd,
                                  SYNCMGR_CF_WAIT);
        pControl->Release();
    }

    ...

}

Requirements

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