Synchronization manager for standardized synchronization of separate programs6560655Abstract A centralized manager for managing the data synchronization operations for multiple applications according to user preferences. Applications register respective COM handlers with the synchronization manager via COM methods. On a synchronize event the synchronization manager queues the registered application handlers, and calls the handlers to perform the synchronization of items therein. Progress and results are communicated to a user-viewable dialog via callbacks from the handlers to the synchronization manager. The synchronization manager provides consistent user interfaces for obtaining user preferences related to synchronization and for presenting information to the user, thus resulting in a consistent user experience. Claims What is claimed is: Description TECHNICAL FIELD
CoCreateInstance(CLSID_Server,NULL,CLSCTX_INPROC_SERVER,IID_IUnknown,&pUnkn
own);
pUnknown->QueryInterface(IID_ISyncMgrSynchronize,&pOffLineSynch);
pUnknown->Release( );
typedef GUID SYNCMGRITEMID
[
local,
object,
uuid(6295DF40-35EE-11d1-8707-00C04FD93327) // IID_ISyncMgrSynchronize
]
interface ISyncMgrSynchronize: IUnknown
{
typedef [unique] ISyncMgrSynchronize *LPSYNCMGRSYNCHRONIZE;
typedef enum_tagSYNCMGRFLAG { // flags for
Synchronization Event
SYNCMGRFLAG_CONNECT = 0x0001,
// Sync was invoked by a network connect
SYNCMGRFLAG_PENDINGDISCONNECT = 0x0002,
// Sync was invoked by a pending network disconnect
SYNCMGRFLAG_MANUAL = 0x0003,
// Sync was invoked manually
SYNCMGRFLAG_IDLE = 0x0004,
// Sync was invoked by an idle event
SYNCMGRFLAG_INVOKE = 0x0005,
// Sync was programmatically invoked by handler
SYNCMGRFLAG_SCHEDULED = 0x0006,
// Sync was invoked by a scheduled update
SYNCMGRFLAG_EVENTMASK = 0x00FF,
SYNCMGRFLAG_SETTINGS = 0x0100,
// Sync was invoked for configuration only
SYNCMGRFLAG_MAYBOTHERUSER = 0x0200,
// interaction with the user is permitted
} SYNCMGRFLAG;
const USHORT MAX_SYNCMGRHANDLERNAME = 32;
typedef enum_tagSYNCMGRHANDLERFLAGS { // flags that
apply to this handler.
SYNCMGRHANDLER_HASPROPERTIES = 0x01, //
have a properties dialog for this handler
SYNCMGRHANDLER_MAYESTABLISHCONNECTION = 0x02, //
handler knows how to dial
SYNCMGRHANDLER_ALWAYSLISTHANDLER = 0x04, //
always list handler as choice
} SYNCMGRHANDLERFLAGS;
typedef struct_tagSYNCMGRHANDLERINFO {
DWORD cbSize;
HICON hIcon;
DWORD SyncMgrHandlerFlags;
WCHAR wszHandlerName[MAX_SYNCMGRHANDLERNAME];
} SYNCMGRHANDLERINFO, *LPSYNCMGRHANDLERINFO;
cpp_quote("#define SYNCMGRITEMSTATE_UNCHECKED 0x0000")
cpp_quote("#define SYNCMGRITEMSTATE_CHECKED 0x0001")
cpp_quote(" ")
typedef enum _tagSYNCMGRSTATUS {
SYNCMGRSTATUS_STOPPED = 0x0000,
SYNCMGRSTATUS_SKIPPED = 0x0001,
SYNCMGRSTATUS_PENDING = 0x0002,
SYNCMGRSTATUS_UPDATING = 0x0003,
SYNCMGRSTATUS_SUCCEEDED = 0x0004,
SYNCMGRSTATUS_FAILED = 0x0005,
SYNCMGRSTATUS_PAUSED = 0x0006,
SYNCMGRSTATUS_RESUMING = 0x0007,
} SYNCMGRSTATUS;
HRESULT Initalize([in] DWORD dwReserved, [in] DWORD dwSynMgrFlags, [in]
DWORD cbCookie, [in]
BYTE const*lpCookie);
HRESULT GetHandlerInfo([out] LPSYNCMGRHANDLERINFO *ppSyncMgrHandlerInfo);
HRESULT EnumSyncMgrItems([out] ISyncMgrEnumItems **ppSyncMgrEnumItems);
HRESULT GetItemObject([in] REFSYNCMGRITEMID ItemID, [in] REFIID riid, [out]
void** ppv);
HRESULT ShowProperties([in] HWND hWndParent, [in] REFSYNCMGRITEMID ItemID);
HRESULT SetProgressCallback([in] ISyncMgrSynchronizeCallback *lpCallBack);
HRESULT PrepareForSync([in] ULONG cbNumItems,[in] SYNCMGRITEMID* pItemIDs,
[in] HWND hWndParent, [in]
DWORD dwReserved);
HRESULT Synchronize([in] HWND hWndParent);
HRESULT SetItemStatus([in] REFSYNCMGRITEMID pItemID, [in] DWORD
dwSyncMgrStatus);
HRESULT ShowError([in] HWND hWndParent, [in] REFSYNCMGRERRORID ErrorID);
}
ISyncMgrSynchronize::Initialize Called by Synchronization manager to determine if the registered application wants to handle the synchronize event. The application cannot bring up UI (a user interface) within this call. If the application needs to bring up UI before synchronization, it is given a change to do so in the PrepareForSync method.
HRESULT Initialize(
[in] DWORD dwReserved,
[in] DWORD dwSyncFlags,
[in] DWORD cbCookie,
[in] const BYTE *lpCookie
);
Parameters dwReserved [in] Reserved Parameter, must be zero dwSyncFlags [in] Flags taken from the SYNCFLAG enumeration. The following flags are defined: SYNCMGRFLAG_CONNECT--Indicates the synchronization was initiated by a network connect. SYNCMGRFLAG_PENDINGDISCONNECT--Indicates the synchronization was initiated by a pending network disconnect. SYNCMGRFLAG_MANUAL--Indicates the synchronization was manually initiated by the User SYNCMGRFLAG_IDLE--Indicates the synchronization was initiated by an idle event. SYNCMGRFLAG_INVOKE--Indicates the synchronization was programmatically initiated by the handler. SYNCMGRFLAG_SCHEDULED--Indicates the synchronization was initiated by a scheduled event. SYNCMGRFLAG_MAYBOTHERUSER.--If this flag is set the application is allowed to show UI and interact with the user. If this flag is not set, the application does not display any UI other than using the ISynchronizeCallback interface. If an application cannot complete the synchronization without bringing up UI, the application fails the synchronization. SYNCMGRFLAG_SETTINGS--Indicates the object was instantiated for configuration purposes in the System Properties dialog. Enumerator will be called to gather item information. cbCookie [in] Size-in bytes of lpCookie data lpCookie [in] Points to the Cookie that the application passed when it programmatically invoked Synchronization Manager. Remarks The SyncFlags apply for the lifetime of the ISyncMgrSynchronize object and are used by the other ISyncMgrSynchronize methods. The only exception for bringing up UI within this call is if it is the very first time the registered applications initialized method is called. The application is allowed to bring up any one-time initialization it needs to set up items and introduce the user to the applications feature. If the application does not recognize the syncflag event, (i.e., a new one has been defined), it should treat the event as a manual sync. A handler should not assume the lpCookie data is NULL if it did not invoke the synchronization. For example, on a schedule invoke the name of the schedule is passed as the cookie data. The handler only controls that value of the data if the sync event is SYNMGRFLAG_INVOKE. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK Initialization was successful. S_FALSE Application does not want to handle this event. Application returns S_FALSE when it does not want to do anything on the synchronization. ISyncMgrSynchronize::GetHandlerInfo Called by the Synchronization manager to obtain handler information
HRESULT GetHandlerInfo (
[out] LPSYNCMGRHANDLERINFO *ppSyncMgrHandlerInfo);
Parameters ppSyncMgrHandlerInfo [out] returns a pointer to a SyncMgrHandlerInfo Structure SyncMgrHandlerInfo Structure Members cbSize--Set to the size of the structure. hIcon--Icon of the Handler SyncMgrHandlerFlags--Flags for Handler. SYNCMGRHANDLER_HASPROPERTIES--indicates the ShowProperties method may be called on the handler. SYNCMGRHANDLER_MAYESTABLISHCONNECTION--Indicates this handler knows how to dial. SYNCMGRHANDLER_ALWAYLISTHANDLER--Handler is shown in choice dialog even if no items are associated with it. Remarks Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK Handler Information was returned successfully ISyncMgrSynchronize:: EnumSyncMgrItems Called by the Synchronization manager to return the object's offline items enumerator.
HRESULT EnumSyncMgrItems (
([out] ISyncMgrEnumItems **ppenumOffineItems // Returns
Offline Items Enumeratar
);
Parameters ppEnumSyncMgrItems [out] if Successful a pointer to a valid ISyncMgrEnumItems interface is returned. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK The enumerator object is successfully instantiated. S_SYNCMGR_MISSINGITEMS The enumerator object is successfully instantiated but some items are missing. When this success code is returned, Synchronization Manager will not remove any stored preferences for ItemIds not returned in the enumerator. Remarks The enumerator object created by this method implements the ISyncMgrEnumItems interface, one of the standard enumerator interfaces that contain the Next, Reset, Clone, and Skip methods. ISyncMgrEnumItems permits the enumeration of the data stored in an array of SYNCMGRITEM structures. Each of these structures provides information on an item that can be prepared for offline operation. ISyncMgrSynchronize:: GetItemObject Called by Synchronization Manager to obtain an interface on the requested Servers Items.
HRESULT GetItemObject (
[in] SYNCMGRITEMID ItemID, //Identifies the requested item
[in] REFIID riid, // Unique identifier for the
// requested interface
[out] void** ppv); //Indirect pointer to the interface
);
Parameters ItemID [in] Identifies the requested item. riid [in] Identifier for the requested interface. ppv [out] if Successful a pointer to a valid interface. Return Values E_NOTIMPL The requested interface was not found Remarks This method is for future use. There are currently no interfaces defined on an Item. Application implementers return E_NOTIMPL from this method. ISyncMgrSynchronize:: ShowProperties The Synchronization manager calls this method when the item is selected in the choice dialog box and the user hits the Properties button.
HRESULT ShowProperties(
[in] HWND hWndParent,
[in] SYNCMGRITEMID ItemID,
);
Parameters hWndParent [in] hwnd that application should use as the Parent of any UI it displays. This value may be NULL. ItemID [in] ItemId that identifies the item to show the properties for. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK Properties dialog for this item was handled properly. Remarks If an application provides a properties dialog for an item, it sets the SYNCMGRITEM_HASPROPERTIES bit in the dwFlags of the items enumerator. If ItemID is GUID_NULL, the handler should show the Properties for the overall handler. The dialog that is displayed should look like a standards Property Page dialog. If a handler returns any success code, it calls the ShowPropertiesCompleted( ) method on the callback. If a failure code is returned from this method, the handler does not call the ShowPropertiesCompleted method. ISyncMgrSynchronize:: SetProgressCallback Synchronization Manager calls this method to set the ProgressCallback Interface. Applications use this callback to give status information from within the PrepareForSync and Synchronize methods.
HRESULT SetProgressCallback (
[in] LPOfflineSynchronizeCallback pSyncCallBack,
// pointer to callback interface
);
Parameters pSyncCallBack [in] Pointer to OfflineSynchronizeCallback interface that the application uses to give Synchronization Manager feedback on its synchronization status and when the synchronization is complete. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK Synchronization was successful. Remarks Applications AddRef the pSyncCallback interface and use it in the other methods to provide status text and progress indicator feedback. If the Application already has a pSyncCallback interface when the method is called, it first releases the old interface and then addreff and hold onto the new interface. Before the ISyncMgrSynchronize object is released, Synchronization Manager will call this method with pSyncCallBack set to NULL. The application should release the pSyncCallback interface previously passed. ISyncMgrSynchronize::PrepareForSync Called by the synchronization manager to give the application a chance to show any UI and do any necessary initialization before the Synchronize method is called. For example, Microsoft.RTM. Outlook.TM. may need to show the password dialog to the User to log onto the mail server. Handlers should return as soon as possible from PrepareForSync and then call the ISyncMgrSynchronizeCallback::PrepareForSyncCompleted ( ) method. It is legal for the Handler to make the PrepareForSyncCompleted call before returning from this method. If an error code is returned from from the PreapreForSync call the handler should not call the PrepareForSyncCompleted method.
HRESULT PrepareForSync (
[in] ULONG cbNumItems,
[in] SYNCMGRITEMID*ItemIDs,
[in] HWND hwndParent, // Parent hwnd for UI.
[in] DWORD dwReserved
);
Parameters cbNumItems [in] Number of Items in the ItemIds array. ItemIDs [in] Array of ItemIDs that the EndUser has selected to synchronize. hwndParent [in] hwnd that application should use as the Parent of any UI it displays. This value may be NULL. dwReserved [in] Reserved Parameter. Applications should ignore this value. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK Preparation was successful. Remarks Applications should only show UI if the SYNCMGRFLAG_MAYBOTHERUSER.flag was set in the dwSyncFlags parameter of Initialize. If an application cannot prepare for the synchronization without showing UI when this flag is not set, it should return S_FALSE for the hr parameter of the PrepareForSyncCompleted method in the callback interface. The array of ItemIDs that are passed into this method also apply to the synchronize method. The Callback methods can be called on any thread. ISyncMgrSynchronize::Synchronize The Synchronization manager calls this method once for each selected group after the user has selected what applications should be synchronized. If the user did not select any of the application's item choices, the application's synchronize method will not be called and the interface will be released. If this method is called, the application synchronizes the items that were specified in the PrepareForSync( ) method. Handlers should return as soon as possible from Syncrhonize method and then call the ISyncMgrSynchronizeCallback::SynchronizeCompleted ( ) method. It is legal for the Handler to make the SynchronizeCompleted call before returning from this method. If a handler returns a failure code from Synchronize, it should not call the SynchronizeCompleted method. The application gives progress feedback and checks if the synchronization should be cancelled by using the pSynchCallBack interface pass previously in the SetProgressCallback method.
HRESULT Synchronize (
in] HWND hWndParent, // Parent hwnd for UI.
);
Parameters hwndParent [in] hwnd that application should use as the Parent of any UI it displays. This value may be NULL. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK Synchronization was successful. Remarks Applications provide progress information even if the SYNCMGRFLAG_MAYBOTHERUSER was not specified in Initialize. Applications should make every attempt not to show UI from within the synchronize method. Any UI should be shown in the PrepareForSync and ShowError methods so the end user experience is to see the UI to logon or specify shares to be synced, then the synchronization can be performed without any user intervention. After the synchronization is complete, conflicts or other error messages can be shown. The Callback methods can be called on any thread. ISyncMgrSynchronize::SetItemStatus Called by the synchronization manager to change the status of an item in between the time that the handler has returned from PrepareForSync and called the PrepareForSyncCompleted callback method, or has returned from Synchronize but has not yet called the SynchronizeCompleted callback method.
HRESULT SetItemStatus (
[in] SYNCMGRITEMID ItemID, // Identifies the Item status
should effect
[in] DWORD dwSyncMgrStatus, // Status to set the item too.
Taken from the SYNCMGRSTATUS enumeration
);
Parameters ItemID [in] Identifies the Item dwSyncMgrStatue [in] Status to set the item too. Taken from the SYNCMGRSTATUS enumeration. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK Status was set. Remarks Currently the only status passed is SYNCMGRSTATUS_SKIPPED and SYNCMGRSTATUS_STOPPED, to skip and stop an item, respectively. When a handler receives this, it should skip or stop the item specified. ISyncMgrSynchronize::ShowError Called by the Synchronization manager when the user double-clicks on the associated message in the Error tab. Handlers should return as soon as possible from ShowError method and then call the ISyncMgrSynchronizeCallback::ShowErrorCompleted ( ) method. It is legal for the handler to make the ShowErrorCompleted call before returning from this method. If a handler returns a failure code from ShowError it should not call the ShowErrorCompleted method.
HRESULT ShowError (
[in] HWND hWndParent, // Parent hwnd for UI.
[in] DWORD dwErrorID, // Parent hwnd for UI.
);
Parameters hwndParent [in] hwnd that application should use as the Parent of any UI it displays. This value may be NULL. dwErrorID [in] ErrorID associated with this Error message. The ErrorID value is what was passed in the ISyncMgrSynchronizeCallback::LogError( ) method. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK Call completed Successfully. Remarks The ShowError method is called when the user double-clicks on the associated error in the error tab. This gives the application an opportunity to display a dialog informing the end user what error occurred or other feedback. Applications may show UI in this method even if the SYNCMGRFLAG_MAYBOTHERUSER flag was not set in the dwSyncFlags parameter of the Initialize method. Applications still call EnableModeless and check the return code before showing UI. ISyncMgrSynchronizeCallback Implemented by the Synchronization manager to allow application to give status feedback and determine if the operation should continue.
[
local,
object,
uuid(6295DF41-35EE-11d1-8707-00C04FD93327) //
IID_ISyncMgrSynchronizeCallback
]
interface ISyncMgrSynchronizeCallback: IUnknown
{
typedef [unique] ISyncMgrSynchronizeCallback
*LPSYNCMGRSYNCHRONIZECALLBACK;
cpp_quote("#define SYNCMGRPROGRESSITEM_STATUSTEXT 0x0001")
cpp_quote("#define SYNCMGRPROGRESSITEM_STATUSTYPE 0x0002")
cpp_quote("#define SYNCMGRPROGRESSITEM_PROGVALUE 0x0004")
cpp_quote("#define SYNCMGRPROGRESSITEM_MAXVALUE 0x0008")
cpp_quote(" ")
typedef struct_tagSYNCMGRPROGRESSITEM {
DWORD cbSize;
UINT mask;
const WCHAR* lpcStatusText;
DWORD dwStatusType;
INT iProgValue,
INT iMaxValue;
} SYNCMGRPROGRESSITEM, *LPSYNCMGRPROGRESSITEM;
typedef enum_tagSYNCMGRLOGLEVEL {
SYNCMGRLOGLEVEL_INFORMATION = 0x0001,
SYNCMGRLOGLEVEL_WARNING = 0x0002,
SYNCMGRLOGLEVEL_ERROR = 0x0003,
} SYNCMGRLOGLEVEL;
cpp_quote("#define SYNCMGRLOGERROR_ERRORFLAGS 0x0001")
cpp_quote("#define SYNCMGRLOGERROR_ERRORID 0x0002")
cpp_quote("#define SYNCMGRLOGERROR_ITEMID 0x0004")
cpp_quote(" ")
typedef enum_tagSYNCMGRERRORFLAGS { // flags that apply to the error.
SYNCMGRERRORFLAG_ENABLEJUMPTEXT = 0x01, // ShowErrors should be
called on this item.
}SYNCMGRERRORFLAGS;
typedef struct_tagSYNCMGRLOGERRORINFO {
DWORD cbSize;
DWORD mask;
DWORD dwSyncMgrErrorFlags;
SYNCMGRERRORID ErrorID;
SYNCMGRITEMID ItemID;
}SYNCMGRLOGERRORINFO, *LPSYNCMGRLOGERRORINFO;
HRESULT ShowPropertiesCompleted([in] HRESULT hr);
HRESULT PrepareForSyncCompleted([in] HRESULT hr);
HRESULT SynchronizeCompleted([in] HRESULT hr);
HRESULT ShowErrorCompleted([in] HRESULT hr, [in] ULONG cbNumItems, [in]
SYNCMGRITEMID *pItemIDs);
HRESULT EnableModeless([in] BOOL fEnable);
HRESULT Progress([in] REFSYNCMGRITEMID pItemID [in] LPSYNCMGRPROGRESSITEM
lpSyncProgressItem);
HRESULT LogError([in] DWORD dwErrorLevel, [in] const WCHAR *lpcErrorText,
[in] LPSYNCMGRLOGERRORINFO
lpSyncLogError);
HRESULT DeleteLogError([in] REFSYNCMGRERRORID ErrorID, [in] DWORD
dwReserved);
HRESULT EstablishConnection([in] WCHAR const * lpwszConnection, [in] DWORD
dwReserved);
}
SYNCMGRPROGRESSITEM Structure Members cbSize--Set to the size of the ProgressItem structure. mask--A set of bit flags that specify attributes of this data structure or of an operation that is using this structure. The following bit flags specify the members of the SYNCMGRPROGRESSITEM structure that contain valid data. One or more of these bit flags may be set:
Value Meaning
SYNCMGRPROGRESSITEM_STATUSTEXT The StatusText
member is valid.
SYNCMGRPROGRESSITEM_PROGVALUE The ProgValue
member is valid.
SYNCMGRPROGRESSITEM_MAXVALUE The MaxValue
member is valid.
LpcStatusText--Text for updating the status text associated with an item. IProgValue--Indicates what to set the ProgressBar value to for an Item IMaxValue--Value for setting the Progress Bar Max Value for an Item ISyncMgrSynchronizeCallback::Progress Called by the application to update the progress feedback and determine if the operation should continue.
HRESULT Progress(
[in] SYNCMGRITEMID ItemID,
[in] LPSYNCMGRPROGRESSITEM lpSyncProgressItem
);
Parameters ItemID [in] ItemId that identifies the item the Progress information applies too. lpSyncProgressItem [in] Pointer to SYNCMGRPROGRESSITEM structure containing the progress information. Return Values S_OK Continue the operation. S_SYNCMGR_CANCELITEM Cancel the operation on the ItemID specified in the ItemID parameter as soon as possible S_SYNCMGR_CANCELALL Cancel the operation on all items associated with this object as soon as possible. Remarks Applications should call this to provide normal feedback even then the SYNCMGRFLAG_MAYBOTHERUSER is specified. Applications should call the Progress method as often as possible to provide feedback to the User. ISyncMgrSynchronizeCallback:: ShowPropertiesCompleted Called by the handler before and after its ShowProperties operation has been completed. HRESULT ShowPropertiesCompleted (HRESULT hrResult); Parameters hrResult [in] indicates if ShowPreoperties was successful. Return Values S_OK Properties dialog was dismissed normally. S_SYNCMGR_ITEMDELETED The Items whose property sheet being displayed has been deleted. S_SYNCMGR_ENUMITEMS When this success code is returned, the synchronization manager will re-enumerate the handler's items. Remarks It is legal for the handler to call this method before returning from the ISyncMgrSynchronize::ShowProperties method. The only time the handler should not call this method if it does not return a success code from the ShowProperties method. ISyncMgrSynchronizeCallback::PrepareForSyncCompleted Called by the handler before and after its PrepareForSync operation has been completed
HRESULT PrepareForSyncCompleted(
HRESULT hrResult
);
Parameters hrResult [in] indicates if PrepareForSync was successful. If S_OK is returned the handlers synchronize method will be called. If the hrResult is set to anything but S_OK the handler will be released without its synchronize method being called. Return Values S_OK Remarks A handler should return as soon as possible from the ISyncMgrSynchronize::PrepareForSync method and then call this method to let Synchronization Manager know that it has completed processing the PrepareForSync call. It is legal for the handler to call this method before returning from the ISyncMgrSynchronize::PrepareForSync method. The only time the handler should not call this method if it does not return a success code from the PrepareForSync method. ISyncMgrSynchronizeCallback::SynchronizeCompleted Called by the application before and after it displays a dialog from within the PrepareForSync, and Synchronize methods.
HRESULT SynchronizeCompleted(
HRESULT hrResult
);
Parameters hrResult [in] indicates if Synchronize was successful. Return Values S_OK Remarks A handler should return as soon as possible from the ISyncMgrSynchronize::Synchronize method and then call this method to let the Synchronization manager know that it has completed processing the Synchronize call. It is legal for the handler to call this method before returning from the ISyncMgrSynchronize::Synchronize method. The only time the handler should not call this method if it does not return a success code from the Synchronize method. ISyncMgrSynchronizeCallback:: ShowErrorCompleted Called by the handler before and after its PrepareForSync operation has been completed. HRESULT ShowErrorCompleted([in] HRESULT hr,[in] ULONG cbNumItems [in] SYNCMGRITEMID *pItemIDs); Parameters hrResult [in] indicates if ShowError was successful. If hrResult is S_SYNCMGR_RETRYSYNC when the handler wants Synchronization Manager to retry the synchronization. When this value is returned to Synchronization Manager both the PrepareForSync( ) and Synchronize methods will be called again. cbNumItems [in] Indicates the number ItemIds in the pItemIDs arg. This parameter is ignored unless hrResult is S_SYNCMGR_RETRYSYNC. pItemIDs [in] pointer to array of ItemIds to pass to PrepareForSync on a retry. This parameter is ignored unless hrResult is S_SYNCMGR_RETRYSYNC. Return Values S_OK Remarks Since pItemIDs is an in parameter the caller owns the memory pointed to by pItemIDs. The Synchronization manager will make a copy of the array before returning. A handler should return as soon as possible from the ISyncMgrSynchronize::ShowError method and then call this method to let Synchronization Manager know that it has completed processing the ShowError call. It is legal for the handler to call this method before returning from the ISyncMgrSynchronize::ShowError method. The only time the handler should not call this method if it does not return a success code from the Showerror method. ISyncMgrSynchronizeCallback::EnableModeless Called by the application before and after they display a dialog from within the PrepareForSync and Synchronize methods.
HRESULT EnableModeless(
[in] BOOL fEnable
);
Parameters fEnable [in] Indicates if application is requesting permission to display a dialog or is done displaying the dialog. Return Values S_OK Continue the operation. S_FALSE The dialog box should not be displayed. Remarks To request permission to display a dialog, the application first calls EnableModeless (TRUE). If S_OK is returned, the application can go ahead and display the dialog. After the dialog box has been displayed, the application must call EnableModeless (FALSE) to let the Synchronization manager know that it is okay to let other items display a dialog. It is not necessary for a handler to call EnableModeless in response to a ShowProperties or ShowErrors method call. SYNCMGRLOGERRORINFO Structure Members cbSize--Set to the size of the LogErrorInfo Struture. mask--A set of bit flags that specify attributes of this data structure or of an operation that is using this structure. The following bit flags specify the members of the SYNCMGRLOGERRORINFO structure that contain valid data. One or more of these bit flags may be set:
Value Meaning
SYNCMGRLOGERROR_ERRORID ErrorID member is valid
SYNCMGRLOGERROR_ITEMID ItemID member is valid.
dwErrorID--Indicates application can display additional details or can take some action related to this error. When this item is set and the User clicks on the error in the results pane the applications ShowError( ) method will be called passing back this ErrorID. ItemID--Indicates to which item this error applies. If the mask bit is not set or t he ItemID is GUID_NULL, the message is interpreted to apply to all items.
#define SYNCMGRLOGERROR_ERRORID 0x0001
#define SYNCMGRLOGERROR_ITEMID 0x0002
typedef struct_tagSYNCMGRLOGERRORINFO {
DWORD mask;
DWORD dwErrorID;
SYNCMGRITEMID ItemID;
} SYNCMGRLOGERRORINFO, *LPSYNCMGRLOGERRORINFO;
ISyncMgrSynchronizeCallback::LogError Called by the application to log an information, warning, or error message into the Error tab on the Synchronization Manager status dialog.
HRESULT LogError(
[in] SYNCMGRLOGLEVEL dwErrorLevel,
[in] WCHAR * lpcErrorText,
[in] LPSYNCMGRLOGERRORINFO lpSyncLogError
);
Parameters dwErrorLevel [in] Indicates the error level. Value taken from the SYNCMGRLOGLEVEL enumeration. lpErrorText [in] ErrorText to be displayed in the Error tab. lpSyncLogError [in] Pointer to SYNCMGRLOGERRORINFO structure containing additional error information. Applications that do not provide this data can pass in NULL for this parameter. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK The Item was successfully logged ISyncMgrSynchronizeCallback:: DeleteLogError Called by the handler to delete a previously logged error information, warning, or error message into the Error tab on the Synchronization Manager status dialog.
HRESULT DeleteLogError(
[in] REFSYNCMGRERRORID ErrorID,
[in] DWORD dwReserved);
Parameters ErrorID [in] Identifies logError to be deleted. If ErrorID is GUID_NULL all errors logged by the instance of the handler will be deleted. dwReserved [in] Reserved for future use. Must be set to zero. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK The Item was successfully deleted from the log. ISyncMgrSynchronizeCallback::EstablishConnection Called by the handler to when it wants to establish a connection. HRESULT EstablishConnectoin( [in] WCHAR const *lpwszConnection, [in] DWORD dwReserved); Parameters lpwszConnection [in] Identifies the name of the Connection to dial dwReserved [in] Reserved for future use. Must be set to zero. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK The Connection was established. Remarks If lpwszConnection is null, then it means that Synchronization Manager should use the default autodial connection. When an instance of EstablishConnection is called by a handler then Synchronization Manager will try to establish the connection. If a subsequent EstablishConnection is called, then the Synchronization manager will attempt the new connection without hanging up the previous connection. Connections will remain until all handlers have finished synchronizing. After all handlers have synchronized then any connections established by the Synchronization manager will be closed. Handlers should only attempt to establish a connection on a manual or invoked synchronization. ISyncMgrEnumItems The ISyncMgrEnumItems interface is used to enumerate through an array of SYNCMGRITEM structures. Each of these structures provides information on an item that can be prepared for offline operation. ISyncMgrEnumItems has the same methods as all enumerator interfaces: Next, Skip, Reset, and Clone.
const USHORT MAX_SYNCMGRITEMNAME = 128;
typedef enum_tagSYNCMGRITEMFLAGS { // flags for this OfflineItem
SYNCMGRITEM_HASPROPERTIES = 0x01, // have a properties dialog
for this item
SYNCMGRITEM_TEMPORARY = 0x02, // Item is a temporary item.
SYNCMGRITEM_ROAMINGUSER = 0x04, // This item should roam
with the User
SYNCMGRITEM_LASTUPDATETIME = 0x08, // Indicates lastUpdateTime
Field is valid
}SYNCMGRITEMFLAGS;
typedef struct_tagSYNCMGRITEM {
DWORD cbSize;
SYNCMGRITEMID ItemID;
DWORD dwItemState;
HICON hlcon;
DWORD dwItemFlags;
WCHAR wszItemName[MAX SYNCMGRITEMNAME];
FILETIME ftLastUpdate;
}SYNCMGRITEM, *LPSYNCMGRITEM;
interface ISyncMgrEnumItems: IUnknown
{
HRESULT Next([in] ULONG celt, [out]LPSYNCMGRITEM rgelt, [out] ULONG
*pceltFetched);
HRESULT Skip([in] ULONG celt);
HRESULT Reset( );
HRESULT Clone([out] ISyncMgrEnumItems **ppenum);
}
typedef [unique] ISyncMgrEnumItems *LPENUMSYNCMGRITEMS;
SYNCMGRITEM Structure Members cbSize--Size of the SYNCMGRITEM structure. ItemID--ItemID for this item. dwItemState--Intial Item State. Used by Synchronization Manager if this is a new ItemID as the items initial value. hIcon--Small Icon used to display next to item in the choice dialog dwFlags--ItemFlags. Only flag currently defined is SYNCMGRITEM_HASPROPERTIES--indicates the ShowProperties method may be called on the item. SYNCMGRITEM_TEMPORARY--indicates that Synchronization Manager that this item is only valid for this instantiation and no preferences should be saved. SYNCMGRITEM_ROAMINGUSER--Indicates that this item should roam with the User. SYNCMGRITEM_LASTUPDATETIME--Indicates lastUpdateTime Field is valid wszItemName--Description of the Item to display in the Choice dialog. ftLastUpdate--Filetime of the last time the item was synchronized. The time is expressed in Coordinated Universal Time (UTC). Remarks The ItemID needs to be the same for an item each time the object is created and uniquely identify the object. ISyncMgrSynchronizeInvoke An application can invoke the synchronization manager to do an UpdateAll or update specific items using the ISyncMgrSynchronizeInvoke interface. An application obtains this interface by doing the following:
CoCreateInstance(CLSID_SYNCMGR,NULL,CLSCTX_ALL,IID_IUnknown,&pUnknown);
pUnknown->QueryInterface(IID_ISyncMgrSynchronizeInvoke,&pSyncInvoke););
// call appropriate synchronization method.
pSyncInvoke->Release( );
pUnknown->Release( );
typedef enum_tagSYNCMGRINVOKEFLAGS { // flags for this OfflineItem
SYNCMGRINVOKE_STARTSYNC = 0x02, // Immediately start the sync
without displaying choices
SYNCMGRINVOKE_MINIMIZED = 0x04, // Dialog should be minimized by
default
}SYNCMGRINVOKEFLAGS;
interface ISyncMgrSynchronizeInvoke: IUnknown
{
HRESULT UpdateItems(([in] dwInvokeFlags, [in] REFCLSID rclsid, [in]
DWORD cbCookie,
[in] const BYTE* lpCookie);
void UpdateAll( );
};
ISyncMgrSynchronizeInvoke::UpdateItems
HRESULT UpdateItems(
[in] DWORD dwInvokeFlags,
[in] REFCLSID rclsid,
[in] DWORD cbCookie,
[in] const BYTE* lpCookie,
);
Parameters dwInvokeFlags [in] Indicates how the item should be invoked. SYNCMGRINVOKE_STARTSYNC--When this flag is set Synchronization Manager will immediately start the synchronization without first displaying the choices to the User. SYNCMGRINVOKE_MINIMIZED--The dialog should be initially displayed as minimized. Note: this flag will not change the state of the dialog if it already exists. rclsid [in] CLSID of the application that should be invoked to handle the Update. cbCookie [in] Size in bytes of lpCookie data lpCookie [in] Points to the private Cookie that Synchronization Manager should pass to the Initialize method of the calling application. This information can be anything the application needs such as a list of shares in the case of CSC. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK The synchronization was successfully E_FAIL Errors occurred during the synchronization ISyncMgrSynchronizeInvoke::UpdateAll Called by an application to programmatically start an Update All. Update All will return immediately and the Synchronization manager will perform the synchronization in a separate process from the Calling application.
void UpdateAll(
);
Parameters none Registering to Participate in Synchronization Manager A synchronization handler is a COM Inproc32 Dll. To register with the synchronization manager, the Stadard COM Activation keys need to be registered. The first time a User makes an item available for offline, the application code should call the Synchronization Manager's RegisterSyncMgrHandler( ) method. When there are no longer any items available offline the UnregisterSyncMgrHandler( ) method should be called. An application obtains this interface by doing the following:
CoCreateInstance(CLSID_SYNCMGR,NULL, CLSCTX_ALL,IID_IUnknown,&pUnknown);
pUnknown->QueryInterface(IID_ISyncMgrRegister,&pSyncRegister);
// call appropriate synchronization method.
pSyncRegister->Release( );
pUnknown->Release( );
[
local,
object,
uuid(6295DF42-35EE-11d1-8707-00C04FD93327), //
IID_ISyncMgrSynchronizeRegister
pointer_default(unique)
]
interface ISyncMgrRegister: IUnknown
{
typedef [unique] ISyncMgrRegister *LPSYNCMGRREGISTER;
typedef enum_tagSYNCMGRREGISTERFLAGS {
SYNCMGRREGISTERFLAG_CONNECT = 0x01, // Register to
receive Connect Events
SYNCMGRREGISTERFLAG_PENDINGDISCONNECT = 0x02, // Register to
receive Disconnect Events
SYNCMGRREGISTERFLAG_IDLE = 0x04, // Register to
receive Idle Events
}SYNCMGRREGISTERFLAGS;
HRESULT RegisterSyncMgrHandler([in] REFCLSID rclsidHandler, [in] WCHAR
const* pwszDescription,
[in] DWORD dwSyncMgrRegisterFlags);
HRESULT UnregisterSyncMgrHandler([in] REFCLSID rclsidHandler, [in] DWORD
dwReserved);
HRESULT GetHandlerRegistrationInfo([in] REFCLSID rclsidHandler, [in,out]
LPDWORD pdwSyncMgrRegisterFlags);
}
ISyncMgrRegister::RegisterSyncMgrHandler A handler should call this method to register with the synchronization manager when it has items to synchronize.
HRESULT RegisterSyncMgrHandler(
[in] REFCLSID rclsid,
[in] WCHAR const *pwsDescription,
[in] DWORD dwSyncMgrRegisterFlags
);
Parameters rclsid [in] CLSID of the handler that should be registered to do synchronizations pwsDescription [in] Text identifying the handler. This parameter may be NULL. dwRegisterFlags [in] Set if handler wants the specified event turned on by default for a User. These defaults only apply to LAN connections. Most handlers will pass zero for this value. If a handler sets one of these values, it needs to ensure that it only calls register the first time an item is made available offline so that it does not keep resetting the user's preference. SYNCMGRREGISTERFLAG_CONNECT--indicates Connect events should be turned on for the User. SYNCMGRREGISTERFLAG_PENDINGDISCONNECT--indicates Logoff events should be turned on for the User. SYNCMGRREGISTERFLAG_IDLE--indicates Idle events should be turned on for the User. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK The handler was successfully registered. ISyncMgrRegister:: UnregisterSyncMgrHandler Called by the handler to remove its CLSID from the registration. A handler should call this when it no longer has any items to synchronize.
HRESULT UnregisterSyncMgrHandler(
[in] REFCLSID rclsidHandler,
[in] DWORD dwReserved
);
Parameters rclsid [in] CLSID of the handler that should be unregistered dwReserved [in] Reserved for future use. Must be zero. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK The handler was successfully removed from being registered with Synchronization Manager. ISyncMgrRegister:: GetHandlerRegistrationInfo Called by the handler to get current registration information.
HRESULT GetHandlerRegistrationInfo(
[in] REFCLSID rclsidHandler,
[in, out] LPDWORD pdwSyncMgrRegisterFlags
);
Parameters rclsid [in] CLSID of the handler that should be unregistered pdwSyncMgrRegisterFlags [in,out] Returns registration flags. Return Values This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following: S_OK Call succeeded and Handler is registered S_FALSE Handler is not registered. The Synchronization Manager Scheduling Interfaces ISyncScheduleMgr Applications use the methods of the ISyncScheduleMgr interface to schedule synchronization objects.
typedef GUID SYNCSCHEDULECOOKIE;
ISyncScheduleMgr::CreateSchedule
HRESULT CreateSchedule(
[in] LPCWSTR pwszScheduleName,
[in] DWORD dwFlags,
[in, out] SYNCSCHEDULECOOKIE *pSyncSchedCookie,
[out] ISyncSchedule. **ppSyncSchedule);
Creates a new Scheduled Synchonization Object.
Returns one of the following values:
S_OK The operation was successful.
ERROR_ALREADY_EXIS A schedule with the specified SYNCSCHEDULECOOKIE
already
TS* exists.
SYNCMGR_E_NAME_IN_U A schedule with the specified name is already in
use.
SE
E_INVALIDARG One or more of the arguments are not valid.
E_OUTOFMEMORY Not enough memory is available to complete the
operation.
pSyncSchedCookie: GUID that specifies the new sync schedule's GUID. Applications use this GUID to for future identification of this sync schedule object. If the [in] parameter is not GUID_NULL, CreateSchedule will try to create a new schedule with the specified SYNCSCHEDULECOOKIE. If the specified schedule already exists, this method will return ERROR_ALREADY_EXISTS. If this [in] parameter is GUID_NULL, CreateSchedule will fill in the [out] SYNCSCHEDULECOOKIE with that of the newly created schedule. pwszScheduleName: LPCWSTR that specifies the new Synchonization Schedule Object's friendly name. This friendly name must be unique. If the name is already being used by and existing schedule, this method will return SYNCMGR_E_NAME_IN_USE, and fill in the Cookie with the GUID of the schedule using this name. ppSyncSchedule: Address of an interface pointer that receives the requested interface. dwFlags: Indicates whether the sync schedule should be editable, or if this schedule relies on a predefined schedule. *Note: Errors will be returned in HRESULT_FROM_WIN32 format.
ISyncScheduleMgr::LaunchScheduleWizard
HRESULT LaunchScheduleWizard(
[in] HWND hParent,
[in] DWORD dwFlags,
[in, out] SYNCSCHEDULECOOKIE *pSyncSchedCookie,
[out] ISyncSchedule ** ppSyncSchedule);
Launches the Scheduled Synchonization Wizard for creating a new sync
schedule Object.
Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG One or more of the arguments are not valid.
S_FALSE The user hit CANCEL
E_OUTOFMEMORY Not enough memory is available to complete
the operation.
hParent: Handle to the parent window of the configuration properties window. pSyncSchedCookie: GUID that specifies the new sync schedule's GUID. Applications use this GUID to for future identification of this sync schedule object. If the [in] parameter is not GUID_NULL, and the specified schedule exists, LaunchScheduleWizard will run through the wizard, using the existing information specified on the SYNCSCHEDULECOOKIE as the default values. If this [in] parameter is GUID_NULL, LaunchScheduleWizard will fill in the [out] SYNCSCHEDULECOOKIE with that of the newly created schedule. ppSyncSchedule: If the schedule wizard is successfully completed, this parameter receives the address of an interface pointer for the newly created schedule. If the wizard is cancelled or fails, this parameter is NULL. dwFlags: Reserved for future use.
ISyncScheduleMgr::OpenSchedule
HRESULT OpenSchedule(
[in] SYNCSCHEDULECOOKIE *pSyncSchedCookie,
[in] DWORD dwFlags,
[out] ISyncSchedule **ppSyncSchedule);
Opens a Scheduled Synchonization Object.
Returns one of the following values:
S_OK The operation was successful.
ERROR_NOT_FOUND* The Schedule with the specified
SYNCSCHEDULECOOKIE does not exist.
E_ACCESS_DENIED Access denied to open this schedule.
E_INVALIDARG One or more of the arguments are not valid.
E_OUTOFMEMORY Not enough memory is available to complete
the operation.
pSyncSchedCookie: Specifies the Sync schedule's SYNCSCHEDULECOOKIE. ppSyncSchedule: Address of an interface pointer that receives the ISyncSchedule interface for the requested SYNCSCHEDULECOOKIE object. dwFlags: Reserved for future use. *Note: Errors will be returned in HRESULT_FROM_WIN32 format.
ISyncScheduleMgr::RemoveSchedule
HRESULT RemoveSchedule (
[in] SYNCSCHEDULECOOKIE *pSyncSchedCookie,
);
Deletes a sync schedule object. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
pSyncSchedCookie: GUID that specifies the sync schedule's GUID.
ISyncScheduleMgr::EnumSyncSchedules
HRESULT EnumSyncSchedules (
[Out] IEnumSyncSchedules ** ppEmumSyncSchedules
);
Retrieves a pointer to an OLE enumerator object that enumerates the sync schedules. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
ppEnumSyncSchedules: Address of a pointer to an IEnumSyncSchedules interface. This interface contains the enumeration context of the current synchronization schedule(s). IEnumSyncSchedules Applications use the methods of the IEnumSyncSchedules interface to enumerate the synchronization schedule objects.
IEnumSyncSchedules::Next
HRESULT Next(
[in] ULONG celt,
[out] SYNCSCHEDULECOOKIE *pSyncSchedCookie,
[out] ULONG * pceltFetched
);
Retrieves the next celt sync schedule objects in the enumeration sequence. If there are less than the requested number of elements left in the sequence, the remaining elements are retrieved. Returns one of the following values:
S_OK The number of sync schedule objects retrieved
equals the number requested
S_FALSE The number returned is less than the number
requested (thus there are no more sync
schedule objects to enumerate).
E_INVALIDARG A parameter is invalid.
E_OUTOFMEMORY Not enough memory is available.
Celt: Number of sync schedule objects to retrieve. ppSyncSchedCookie: Address of an array of SYNCSCHEDULECOOKIEs that contain the GUIDs of sync schedule objects returned from the enumeration sequence. The client is responsible for freeing the array. pceltFetched:Address of a value that contains the number of sync schedules returned in pSyncSchedCookie. If the celt parameter is 1, this parameter can be NULL.
IEnumSyncSchedules::Skip
HRESULT Skip(
[in] ULONG celt);
Skips the next celt number of sync schedule objects in the enumeration sequence. Returns one of the following values:
S_OK The number of elements skipped equals celt.
S_FALSE The number of elements remaining in the sequence
is less than celt.
E_INVALIDA celt is less than or equal to zero.
RG
Celt: Number of sync schedules to be skipped. IEnumSyncSchedules::Reset HRESULT Reset(void); Resets the enumeration sequence to the beginning. Returns S_OK if successful, or E_OUTOFMEMORY if there is not enough available memory. A call to this method does not guarantee that the same set of sync schedule objects will be enumerated after the reset.
IEnumSyncSchedules::Clone
HRESULT Clone (
[out] IEnumSyncSchedules ** ppEnumSyncSchedules
);
Creates another enumerator that contains the same enumeration state as the current one. Using this method, a client can record a particular point in the enumeration sequence and return to that point later. The new enumerator supports the same interface as the original. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The argument is not valid.
E_OUTOFMEMORY There is not enough memory available.
E_UNEXPECTED An error occurred.
ppEnumSyncSchedules:Address of a pointer to an IEnumSyncSchedules interface that will be assigned to the newly created enumeration. If the method fails, this parameter will be NULL. ISyncSchedule Applications use the methods of the ISyncSchedule interface to set and retrieve sync schedule information for a particular synchronization schedule object.
ISyncSchedule::GetFlags
HRESULT GetFlags(
[out] DWORD *pdwFlags);
Retrieves the flags for the specified SyncSchedule. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
pdwFlags: Pointer to dword containing information about the sync schedule. Currently, two flags are used by the SyncSchedule. Others are reserved for future use. #define SYNCSCHEDINFO_FLAGS_READONLY 0x0001 #define SYNCSCHEDINFO_FLAGS_AUTOCONNECT 0x0002 #define SYNCSCHEDINFO_FLAGS_AUTOHIDDEN 0x0004 If (dwFlags & SYNCSCHEDINFO_FLAGS_READONLY) the schedule times will be uneditable by the user. This is useful for publisher defined synchronization schedules. If (dwFlags & SYNCSCHEDINFO_FLAGS_AUTOCONNECT) the Sync Manager will attempt to automatically establish the Connection prior to synchronizing. If (dwFlags & SYNCSCHEDINFO_FLAGS_AUTOHIDDEN) the Sync Schedule will be hidden, and not enumerated in the list of sync schedules.
ISyncSchedule::SetFlags
HRESULT SetFlags(
[in] DWORD dwFlags);
Sets the flags for a specified Synchronization Schedule object. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
dwFlags: dword containing information about the sync schedule. See above descriptions of the flags.
ISyncSchedule::GetConnection
HRESULT GetConnection(
[in, out] DWORD *pcbSize,
[out] LPWSTR pwszConnectionName,
[out] DWORD *pdwConnType);
Gets the Connection for this Sync Schedule Object. Returns one of the following values:
S_OK The operation was successful.
E_INSUFFICIENT
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
pwszConnectionName: A character string that will contain the retrieved Connection name. pdwConnType: A pointer to DWORD that will contain the type of connection. This can be either SYNCSCHEDINFO_FLAGS_CONNECTION_LAN or SYNCSCHEDINFO_FLAGS_CONNECTION_WAN. PcbSize Address of the DWORD containing the size of buffer allocated for ppwszScheduleName. If the buffer is too small, this param will be filled in with the needed size.
ISyncSchedule::SetConnection
HRESULT SetConnection(
[in] LPCWSTR pwszConnectionName,
[in] DWORD dwConnType);
Sets the Connection for this Sync Schedule Object. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
pwszConnectionName: Character string that contains the Connection name. The Connection name is limited to MAX_PATH characters. pdwConnType: DWORD that contains the type of connection. This can be either SYNCSCHEDINFO_FLAGS_CONNECTION_LAN or SYNCSCHEDINFO_FLAGS_CONNECTION_WAN. If this parameter is SYNCSCHEDINFO_FLAGS_CONNECTION_WAN, pwszConnectionName must be non-null.
ISyncSchedule::GetScheduleName
HRESULT GetScheduleName(
[in, out] DWORD *pcbSize,
[out] LPWSTR pwszScheduleName);
Gets the friendly Schedule name for this Sync Schedule Object. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
PpwszScheduleName: A character string that will contain the retrieved friendly schedule name. PcbSize: Address of the DWORD containing the size of buffer allocated for ppwszScheduleName. If the buffer is too small, this param will be filled in with the needed size.
ISyncSchedule::SetScheduleName
HRESULT SetScheduleName(
[in] LPCWSTR pwszNewScheduleName);
Set the friendly name of a Scheduled Synchonization Object. Returns one of the following values:
S_OK The operation was successful.
SYNCMGR_E_NAME_IN_USE A schedule with the specified
name is already in use.
E_ACCESS_DENIED Access to rename this schedule
denied.
E_INVALIDARG One or more of the arguments are
not valid.
E_OUTOFMEMORY Not enough memory is available to
complete the operation.
pwszNewScheduleName: LPCWSTR that specifies the sync schedule's new friendly name. This friendly name must be unique. If the name is already being used by and existing schedule, this method will return SYNCMGR_E_NAME_IN_USE. The Friendly name must be at most MAX_PATH characters.
ISyncSchedule::GetScheduleCookie
HRESULT GetScheduleName (
[out] SYNCSCHEDULECOOKIE *pSyncSchedCookie);
Gets the Schedule Cookie for this Sync Schedule Object. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
PSyncSchedCookie: A pointer to SYNCSCHEDULECOOKIE that will contain the GUID of the schedule.
ISyncSchedule::SetAccountInformation
HRESULT SetAccountInformation(
[in] LPCWSTR pwszAccountName,
[in] LPCWSTR pwszPassword);
Sets the account name and password for the sync schedule. This method is for Windows NT.RTM.; it does nothing in Windows.RTM. 95. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
PwszAccountName: LPCWSTR that contains the account name. This account name is assigned to the current task. PwszPassword: LPCWSTR that contains the account password. This password is assigned to the current task.
ISyncSchedule::GetAccountInformation
HRESULT GetAccountInformation(
[in, out] DWORD *pcbSize,
[out] LPWSTR pwszAccountName);
Retrieves the account name for the sync schedule. This method is for Windows NT.RTM.; it does nothing in Windows.RTM. 95. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
SCHED_E_ACCOUNT_INF The Account info has not been
ORMATION_NOT_SET set.
SCHED_E_CANNOTOPEN GetAccountInfo can only retrieve
TASK Account info from Schedules that
have been previously persisted
with Account info. saved.
E_OUTOFMEMORY Not enough memory is available.
PpwszAccountName: An LPWSTR that will contain the account name for the current task. PcbSize : Address of the DWORD containing the size of buffer allocated for ppwszAccountName. If the buffer is too small, this param will be filled in with the needed size. The method that invokes GetAccountInformation is responsible for freeing the string.
ISyncSchedule::GetTrigger
HRESULT GetTrigger(
[out] ITaskTrigger ** ppTrigger);
Gets the task trigger for this Sync Schedule Object. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
ppTrigger Address of a pointer to an ITaskTrigger interface.
ISyncSchedule::GetNextRunTime
HRESULT GetNextRunTime(
[out] SYSTEMTIME * pstNextRun);
Retrieves the next time the sync schedule item will run. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
PstNextRun: Address of a SYSTEMTIME structure that contains the next time the work item will run.
ISyncSchedule::GetMostRecentRunTime
HRESULT GetMostRecentRunTime(
[out] SYSTEMTIME * pstRecentRun
);
Retrieves the most recent time the sync schedule began running. Returns one of the following values:
S_OK The operation was
successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is
available.
SCHED_S_TASK_HAS_NOT_RUN The sync schedule has
never run.
PstLastRun: Address of a SYSTEMTIME structure that contains the most recent time the current task ran.
ISyncSchedule::EditSyncSchedule
HRESULT EditSyncSchedule(
[in] HWND hParent,
[in] DWORD dwReserved);
Opens the configuration properties for the sync schedule item. Returns one of the following values:
S_OK The operation was successful.
S_FALSE The user hit CANCEL
STG_E_NOTFILEBASEDSTORAGE The task object is not persistent.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is
available.
HParent: Handle to the parent window of the configuration properties window. DwReserved: Reserved for future use; this parameter is ignored.
typedef struct_tagSYNC_HANDLER_ITEM_INFO
} GUID handlerID;
SYNCMGRITEMID itemID;
HICON hIcon;
WCHAR wszItemName [MAX_SYNCMGRITEMNAME];
DWORD dwCheckState;
} SYNC_HANDLER_ITEM_INFO,
*LPSYNC_HANDLER_ITEM_INFO;
ISyncSchedule::AddItem
ISyncSchedule::AddItem
HRESULT AddItem(
[in] LPSYNC_HANDLER_ITEM_INFO pHandlerItemInfo);
Add the specified handler item to this Sync Schedule object. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
pHandlerItemInfo: Pointer to the application handler/item data for which to add the item. The item will be added and registered with the handler items.
ISyncSchedule::SetItemCheck
HRESULT SetItemCheck(
[in] REFCLSID pHandlerID,
[in] SYNCMGRITEMID *pItemID,
[in] DWORD dwCheckState);
Sets the check state of the specified handler item. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
pHandlerID: Specifies a pointer to the application handler ID for which to add the item pItemID: A pointer to a SYNCMGRITEMID that uniquely identifies a scheduled sync item for the specified handler. dwCheckState: The Check State. 1==Checked, 0==Unchecked.
ISyncSchedule::GetItemCheck
HRESULT GetItemCheck(
[in] REFCLSID pHandlerID,
[in] SYNCMGRITEMID *pItemID,
[out] DWORD *pdwCheckState);
Sets the check state of the specified handler item. Returns one of the following values:
S_OK The operation was successful.
E_INVALDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
pHandlerID: Specifies a pointer to the application handler ID for which to add the item pItemID: A pointer to a SYNCMGRITEMID that uniquely identifies a scheduled sync item for the specified handler. pdwCheckState: A pointer to DWORD to receive the Check State. 1==Checked, 0==Unchecked.
ISyncSchedule::EnumItems
HRESULT EnumItems(
[in] REFCLSID pHandlerID,
[in] IEnumSyncItems **ppEnumItems);
Retrieves a pointer to an OLE enumerator object that enumerates the items on the current sync schedule. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The arguments are not valid.
E_OUTOFMEMORY Not enough memory is available.
pHandlerID: Specifies a pointer to the application handler ID for which to enumerate. If this parameter is GUID_NULL, the IEnumSyncItems interface will enumerate all synchonization items for all handlers. ppEnumItems:Address of a pointer to an IEnumSyncItems interface. This interface contains the enumeration context for the item(s) on the current sync schedule object. ISyncSchedule::Save HRESULT Save( ); Commits the sync schedule to disk. Clients call this method to persist any changes made to the SyncSchedule. Returns one of the following values:
S_OK The operation was successful.
E_FAIL The sync schedule save not saved
IEnumSyncItems Applications use the methods of the IEnumSyncItems interface to enumerate the sync items on a given synchronization schedule.
typedef struct_tagSYNC_HANDLER_ITEM_INFO
{ GUID handlerID;
SYNCMGRITEMID itemID;
HICON hIcon;
WCHAR wszItemName[MAX_SYNCMGRITEMNAME];
DWORD dwCheckState;
} SYNC_HANDLER_ITEM_INFO,
*LPSYNC_HANDLER_ITEM_INFO;
IEnumSyncItems::Next
IEnumSyncItems::Next
HRESULT Next(
ULONG celt,
[out] SYNC_HANDLER_ITEM_INFO **ppHandlerItemList
[out] ULONG * pceltFetched
);
Retrieves the next celt sync items in the enumeration sequence. If there are fewer than the requested number of elements left in the sequence, the remaining elements are retrieved. Returns one of the following values:
S_OK The number of sync schedules retrieved equals
the number requested.
S_FALSE The number returned is less than the number
requested (thus there are no more sync schedules
to enumerate).
E_INVALIDARG A parameter is invalid.
E_OUTOFMEMORY Not enough memory is available.
Celt: Number of sync items to retrieve. ppHandlerItemList: Address of an array of pointers to SYNC_HANDLER_ITEM_INFO Struct, returned from the enumeration sequence. Clients are responsible for freeing each of the SYNC_HANDLER_ITEM_INFO pointers in the array, and the array itself. pceltFetched:Address of a value that contains the number of SYNC_HANDLER_ITEM_INFO struct pointers returned in ppHandlerItemList. If the celt parameter is 1, this parameter can be NULL.
IEnumSyncItems::Skip
HRESULT Skip(
[in] ULONG celt,
);
Skips the next celt number of sync items in the enumeration sequence. Returns one of the following values:
S_OK The number of elements skipped equals celt.
S_FALSE The number of elements remaining in the sequence is
less than celt.
E_INVALIDA Celt is less than or equal to zero.
RG
Celt: Number of sync schedules to be skipped. IEnumSyncItems::Reset HRESULT Reset(void); Resets the enumeration sequence to the beginning. Returns S_OK if successful, or E_OUTOFMEMORY if there is not enough available memory. A call to this method does not guarantee that the same set of sync items will be enumerated after the reset.
IEnumSyncItems::Clone
HRESULT Clone(
IEnumSyncItems ** ppEnumSyncItems
);
Creates another enumerator that contains the same enumeration state as the current one. Using this method, a client can record a particular point in the enumeration sequence and return to that point later. The new enumerator supports the same interface as the original. Returns one of the following values:
S_OK The operation was successful.
E_INVALIDARG The argument is not valid.
E_OUTOFMEMORY There is not enough memory available.
E_UNEXPECTED An error occurred.
PpEnumSyncItems:Address of a pointer to an IEnumSyncItems interface that will be assigned to the newly created enumeration. If the method fails, this parameter is NULL. As can be seen from the foregoing detailed description, there is provided a centralized synchronization manager that provides a user with a consistent user experience while eliminating the need for the user to separately launch applications to synchronize data. Synchronization takes place on events triggered according to a user's preferences, and may be automatic according to the user preferences and/or a schedule, or manual. The synchronization manager provides standard interfaces usable by any application to handle the synchronization of data in a consistent, efficient and extensible way. While the invention is susceptible to various modifications and alternative constructions, a certain illustrated embodiment thereof is shown in the drawings and has been described above in detail. It should be understood, however, that there is no intention to limit the invention to the specific form or forms disclosed, but on the contrary, the intention is to cover all modifications, alternative constructions, and equivalents falling within the spirit and scope of the invention.
|
Same subclass | ||||||||||
