ISpObjectTokenCategory::GetId

Microsoft Speech SDK

The Microsoft.com Speech website Microsoft Speech SDK SAPI 5.1

ISpObjectTokenCategory::GetId

ISpObjectTokenCategory::GetId retrieves the category ID.


HRESULT GetId(
   WCHAR   **ppszCoMemCategoryId
);

Parameters

ppszCoMemCategoryId
[in] The null-terminated string name of the current category. ppszCoMemCategoryId must be freed with CoMemTaskFree 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.

HRESULT hr;

CComPtr<ISpObjectTokenCategory> cpSpCategory;
CSpCoTaskMemPtr<WCHAR> cpwszOldID;

hr = SpGetCategoryFromId(SPCAT_VOICES, &cpSpCategory;);
//Check return code

hr = cpSpCategory->GetId(&cpwszOldID;);
//Check return code

CoMemTaskFree(cpwszOldID);