Share via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Microsoft Speech Platform

ISpObjectTokenCategory::GetId

ISpObjectTokenCategory::GetId retrieves the category ID.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT GetId(</strong> <strong> LPWSTR </strong> **<em>ppszCoMemCategoryId</em> <strong>);</strong> </pre>

Parameters

  • ppszCoMemCategoryId
    [in] The null-terminated string name of the current category. ppszCoMemCategoryId must be freed with CoTaskMemFree when no longer required.

Return Values

Value Description
S_OK Function completed successfully.
SPERR_UNINITIALIZED Category interface is not initialized.
E_POINTER ppszCoMemCategoryId is invalid or bad.
FAILED(hr) Appropriate error message.

Example

The following code snippet retrieves CategoryId for SPCAT_VOICES.

`

// Declare local identifiers:
HRESULT                           hr = S_OK;
CComPtr<ISpObjectTokenCategory>   cpSpObjectTokenCategory;
WCHAR                             *cpwszOldID;

hr = SpGetCategoryFromId(SPCAT_VOICES, &cpSpObjectTokenCategory;);

if (SUCCEEDED (hr)) { hr = cpSpObjectTokenCategory->GetId(&cpwszOldID;); }

if (SUCCEEDED (hr)) { CoTaskMemFree(cpwszOldID); }

`