Partager via


ISpObjectToken::Remove (SAPI 5.3)

Microsoft Speech API 5.3

ISpObjectToken::Remove

ISpObjectToken::Remove removes an object token.

  
    HRESULT Remove(
   const CLSID  *pclsidCaller
);

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
S_OK
E_POINTER
SPERR_UNINITIALIZED
SPERR_TOKEN_DELETED
FAILED(hr)

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.
}