IModelKeyReference2::SetKeyValue メソッド (dbgmodel.h)
キー参照の SetKeyValue メソッドは、IModelObject の SetKeyValue メソッド 動作します。 キーの値が割り当てられます。 元のキーがプロパティ アクセサーであった場合、プロパティ アクセサー自体を置き換えるのではなく、基になる SetValue メソッドをプロパティ アクセサーで呼び出します。
構文
HRESULT SetKeyValue(
IModelObject *object
);
パラメーター
object
キーに割り当てる値。
戻り値
このメソッドは、成功または失敗を示す HRESULT を返します。
備考
コード サンプル
ComPtr<IDataModelManager> spManager; /* get the data model manager */
ComPtr<IModelObject> spObject; /* get an object */
ComPtr<IModelKeyReference> spKeyRef;
if (SUCCEEDED(spObject->GetKeyReference(L"Id", &spKeyRef, nullptr)))
{
VARIANT vtValue;
vtValue.vt = VT_UI8;
vtValue.ullVal = 42;
ComPtr<IModelObject> sp42;
if (SUCCEEDED(spManager->CreateIntrinsicObject(ObjectIntrinsic, &vtValue, &sp42)))
{
if (SUCCEEDED(spKeyRef->SetKeyValue(sp42.Get())))
{
// The value of the "Id" key is now 42. If the "Id" key originally
// was a property accessor, this successfully called
// the SetValue() method on the property accessor. In such a case,
// the property accessor was not replaced with the static 42,
// it was called to set the value 42.
}
}
}
必要条件
要件 | 価値 |
---|---|
ヘッダー | dbgmodel.h |
関連項目
IModelKeyReference2 インターフェイス の