Επεξεργασία

Κοινή χρήση μέσω


ISyncMgrHandlerCollection interface (syncmgr.h)

Exposes methods that provide an enumerator of sync handler IDs and instantiate those sync handlers.

Inheritance

The ISyncMgrHandlerCollection interface inherits from the IUnknown interface. ISyncMgrHandlerCollection also has these types of members:

Methods

The ISyncMgrHandlerCollection interface has these methods.

 
ISyncMgrHandlerCollection::BindToHandler

Instantiates a specified sync handler when called by Sync Center.
ISyncMgrHandlerCollection::GetHandlerEnumerator

Gets an enumerator that provides access to the IDs of sync handlers exposed to and managed by the user.

Remarks

The author of a sync handler implements this interface to support multiple devices or computers and sync their details independently. Sync Center uses the handler collection to request instantiation of individual sync handlers. ISyncMgrHandlerCollection also allows a sync handler author to add handlers dynamically to Sync Center as opposed to registering each one individually in the registry.

The following example shows an outline implementation of this interface.

class CMyHandlerCollection : public ISyncMgrHandlerCollection
{
public:
    // IUnknown
    // ISyncMgrHandlerCollection
    IFACEMETHODIMP GetHandlerEnumerator(__out IEnumString **ppenum);
    IFACEMETHODIMP BindToHandler(
        __in LPCWSTR    pszHandlerID,
        __in REFIID     riid,
        __out void    **ppv);
};

STDMETHODIMP CMyHandlerCollection::GetHandlerEnumerator(
    __out IEnumString **ppenum)
{
    // IDs are retrieved from a data source such as the registry.
    // IDs could be retrieved either by this collection class 
    // or the factory method.
    return CEnumMyHandlerIDs_Create(ppenum);
}

STDMETHODIMP CMyHandlerCollection::BindToHandler(
    __in LPCWSTR    pszHandlerID,
    __in REFIID     riid,
    __out void    **ppv)
{
    // Map the pszHandlerID to the handler to create. This could be done
    // by the factory method or by some other method.
    return CMyHandler_Create(pszHandlerID, riid, ppv);
}

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