ISpObjectTokenCategory::GetDataKey
ISpObjectTokenCategory::GetDataKey gets the data key associated with a specific location.
HRESULT GetDataKey(
SPDATAKEYLOCATION spdkl,
ISpDataKey **ppDataKey
);
Parameters
- spdkl
- [in] The registry's top-level node to be searched.
- ppDataKey
- [out] The data key interface associated with the location spdkl.
Return values
Value | Description |
---|---|
S_OK | Function completed successfully. |
SPERR_UNINITIALIZED | Data key interface is not initialized. |
E_POINTER | ppDataKey is invalid or bad. |
FAILED(hr) | Appropriate error message. |
Example
The following code snippet retrieves the data key associated with the local computer registry for SPCAT_VOICES.
// Declare local identifiers:
HRESULT hr = S_OK;
CComPtr<ISpObjectTokenCategory> cpSpObjectTokenCategory;
CComPtr<ISpDataKey> cpSpDataKey;
hr = SpGetCategoryFromId(SPCAT_VOICES, &cpSpObjectTokenCategory;);
if (SUCCEEDED (hr))
{
hr = cpSpObjectTokenCategory->GetDataKey(SPDKL_LocalMachine, &cpSpDataKey;);
}
if (SUCCEEDED(hr))
{
// Do stuff here.
}