Share via


Note

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

Microsoft Speech Platform

ISpObjectToken::Remove

ISpObjectToken::Remove removes an object token.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT Remove(</strong> <strong>const CLSID </strong> *<em>pclsidCaller</em> <strong>);</strong> </pre>

Parameters

  • pclsidCaller
    [in] Address of the identifier associated with the object token to remove. If pclsidCaller is NULL, the entire token is removed; otherwise, only the specified section is removed.

Return Values

Value Description
S_OK Function completed successfully.
E_POINTER pclsidCaller is invalid or bad.
SPERR_UNINITIALIZED The token ID interface is uninitialized.
SPERR_TOKEN_DELETED Key has been deleted.
FAILED(hr) Appropriate error message.

Example

The following code snippet creates and removes a token object for a test file.

`

// Declare local identifiers:
HRESULT                   hr = S_OK;
CComPtr<ISpObjectToken>   cpObjectToken;
GUID                      guid0;
WCHAR                     *cpFileName;
ULONG                     CSIDL_LOCAL_APPDATA = 28;
ULONG                     CSIDL_FLAG_CREATE = 32768;

// Get the default text-to-speech engine token. hr = SpGetDefaultTokenFromCategoryId(SPCAT_VOICES, &cpObjectToken;);

if (SUCCEEDED (hr)) { hr = CoCreateGuid(&guid0;); }

if (SUCCEEDED (hr)) { // Create file with default format and store it in folder that // contains application-specific data that does not roam. hr = cpObjectToken->GetStorageFileName(guid0, L"TestFile", NULL, CSIDL_FLAG_CREATE|CSIDL_LOCAL_APPDATA, &cpFileName;); }

if (SUCCEEDED (hr)) { // Remove object token. hr = cpObjectToken->Remove(&guid0;); }

if (SUCCEEDED(hr)) { // Do stuff here. }

`