IModelObject::GetKeyValue method (dbgmodel.h)

The GetKeyValue method is the first method a client will turn to in order to get the value of (and the metadata associated with) a given key by name. If the key is a property accessor -- that is it's value as an IModelObject which is a boxed IModelPropertyAccessor, the GetKeyValue method will automatically call the property accessor's GetValue method in order to retrieve the actual value.

Syntax

HRESULT GetKeyValue(
  PCWSTR                          key,
  _COM_Errorptr_opt_ IModelObject **object,
  IKeyStore                       **metadata
);

Parameters

key

The name of the key to get a value for.

object

The value of the key will be returned in this argument. In some error cases, extended error information may be passed out in this argument even though the method returns a failing HRESULT.

metadata

The metadata store associated with this key will be optionally returned in this argument.

Return value

This method returns HRESULT that indicates success or failure. The return values E_BOUNDS (or E_NOT_SET in some cases) indicates the key could not be found.

Remarks

Code Sample

ComPtr<IModelObject> spProcess; /* get a process object */

ComPtr<IModelObject> spProcId;
if (SUCCEEDED(spProcess->GetKeyValue(L"Id", &spProcId, nullptr)))
{
    // spProcId has a boxed process id.  Use GetIntrinsicValueAs to unbox it.
}

Requirements

Requirement Value
Header dbgmodel.h

See also

IModelObject interface