CUtlProps::OnPropertyChanged

调用在设置属性后处理链接的属性。

virtual HRESULT OnPropertyChanged( 
   ULONG /* iCurSet */, 
   DBPROP* pDBProp  
);

参数

  • iCurSet
    索引属性设置数组中;零,如果只有一个属性。

  • pDBProp
    属性 ID 和新值在 DBPROP 结构。

返回值

标准 HRESULT。 默认返回值为 S_OK。

备注

如果希望处理被链接的属性,如书签或来更新的值依赖于另一个属性的值,应重写此函数。

示例

在此函数中,用户从 DBPROP* 参数获取属性 ID。 现在,将链接 ID 属性比较可能的。 如果找到属性时,SetProperties 调用与其他与属性结合现在将设置属性。 在这种情况下,获取一,如果 DBPROP_IRowsetLocate、DBPROP_LITERALBOOKMARKS或 DBPROP_ORDEREDBOOKMARKS 属性,可设置 DBPROP_BOOKMARKS 属性。

HRESULT OnPropertyChanged(ULONG /*iCurSet*/, DBPROP* pDBProp)
{
   ATLASSERT(pDBProp != NULL);

   DWORD dwPropertyID = pDBProp->dwPropertyID;

   if (dwPropertyID == DBPROP_IRowsetLocate || 
      dwPropertyID == DBPROP_LITERALBOOKMARKS ||
      dwPropertyID == DBPROP_ORDEREDBOOKMARKS)
   {
      CComVariant var = pDBProp->vValue;

      if (var.boolVal == VARIANT_TRUE)
      {
         // Set the bookmarks property as these are chained
         CComVariant bookVar(true);
         CDBPropSet set(DBPROPSET_ROWSET);
         set.AddProperty(DBPROP_BOOKMARKS, bookVar);

         return SetProperties(1, &set);
      }
   }

   return S_OK;
}

要求

页眉: atldb.h

请参见

参考

CUtlProps 类