ISpObjectToken::Remove

This method removes an object token.

HRESULT Remove(
  const CLSID* pclsidCaller
);

Parameters

  • pclsidCaller
    [in] Pointer to the CLSID associated with the object token to remove. If the identifier is NULL, the method removes the entire token. Otherwise, it only removes the specified section.

Return Values

The following table shows the possible return values.

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

Example

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

HRESULT hr;
GUID guid0;

CComPtr cpSpObjectToken;
CSpCoTaskMemPtr cpFileName;

hr = SpGetDefaultTokenFromCategoryId(SPCAT_VOICES, &cpSpObjectToken);
//Check return value

ZeroStruct(guid0);
hr = cpSpObjectToken->GetStorageFileName(
guid0, L"TestFile", NULL, CSIDL_FLAG_CREATE|CSIDL_APPDATA, &cpFileName
);
//Check return value

hr = cpSpObjectToken->Remove(&guid0);
//Check return value

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: sapi.h, sapi.idl.
Link Library: Sapilib.lib.

See Also

ISpObjectToken | SAPI Interfaces

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.