Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
To initialize the device provider, call InitObjType. If the device provider supports synchronization of multiple object types, it calls InitObjTypefor each object type whose lpszObjTypeis not NULL. When an ActiveSync service terminates, the lpszObjTypeof its objects are set to NULL, thereby allowing the device provider to free any resources it may have allocated.
The following code example shows how to implement InitObjType.
Copy Code | |
---|---|
EXTERN_C BOOL InitObjType ( LPWSTR lpszObjType, IReplObjHandler **ppObjHandler, UINT uPartnerBit ) { if (lpszObjType == NULL) { // Terminates device provider and frees all allocated resources. // ... return TRUE; } // Allocates a new IReplObjHandler. *ppObjHandler = new CDataHandler; // Saves uPartnerBit for later use in ObjectNotify. // ... // Initializing the module. // ... return TRUE; } |
ActiveSync supports the synchronization of two desktop computers with a Windows Embedded CE–based device. To differentiate between two computers, the service manager passes a partner bit to InitObjTypewhen initializing the device provider. This bit is 1 if the connected desktop computer is the first partner and 2 if it is the second partner. The device provider must use this partner bit when setting and resetting "dirty" bits of an object.