IProviderSyncServices::CreateSyncKnowledge
创建一个属于指定副本的空 ISyncKnowledge 对象。
HRESULT CreateSyncKnowledge(
ULONGLONG ullCurrentTickCount,
IReplicaKeyMap *pReplicaKeyMap,
ISyncKnowledge **ppKnowledge);
参数
- pullCurrentTickCount
[in] 拥有新创建的知识对象的副本的当前滴答计数。
- pReplicaKeyMap
[in] 新创建的知识对象将包含的副本键映射。
- ppKnowledge
[out] 返回新创建的知识对象。
返回值
S_OK
E_OUTOFMEMORY
E_POINTER
如果未初始化此对象,则返回值为 SYNC_E_INVALID_OPERATION。
示例
以下示例使用 IProviderSyncServices
创建多个对象。此示例存储这些对象供以后使用。
IProviderSyncServices* pProvSvc;
hr = GetProviderSyncServices(&c_idParams, &pProvSvc);
if (SUCCEEDED(hr))
{
IReplicaKeyMap* pReplicaKeyMap = NULL;
hr = pProvSvc->CreateReplicaKeyMap((BYTE*)&guidReplicaID, &pReplicaKeyMap);
if (SUCCEEDED(hr))
{
hr = SetReplicaKeyMap(pReplicaKeyMap);
if (SUCCEEDED(hr))
{
ISyncKnowledge* pKnowledge = NULL;
hr = pProvSvc->CreateSyncKnowledge(0, pReplicaKeyMap, &pKnowledge);
if (SUCCEEDED(hr))
{
hr = SetKnowledge(pKnowledge);
if (SUCCEEDED(hr))
{
IForgottenKnowledge* pForgottenKnowledge = NULL;
hr = pProvSvc->CreateForgottenKnowledge(pReplicaKeyMap, &pForgottenKnowledge);
if (SUCCEEDED(hr))
{
hr = SetForgottenKnowledge(pForgottenKnowledge);
pForgottenKnowledge->Release();
}
}
pKnowledge->Release();
}
}
pReplicaKeyMap->Release();
}
pProvSvc->Release();
}