Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining

ISpObjectToken::Remove (SAPI 5.4)

Speech API 5.4
Microsoft Speech API 5.4


ISpObjectToken::Remove removes an object token.

   const CLSID  *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

S_OKFunction completed successfully.
E_POINTERpclsidCaller is invalid or bad.
SPERR_UNINITIALIZEDThe token ID interface is uninitialized.
SPERR_TOKEN_DELETEDKey has been deleted.
FAILED(hr)Appropriate error message.


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.
© 2015 Microsoft