Compartir a través de


ISpObjectToken::RemoveStorageFileName (Windows CE 5.0)

Send Feedback

This method removes the object token file name.

HRESULT RemoveStorageFileName(  REFCLSID clsidCaller,  const WCHAR* pszKeyName,  BOOL fDeleteFile);

Parameters

  • clsidCaller
    [in] GUID of the calling object.
  • pszKeyName
    [in] Pointer to a null-terminated string specifying the registry key name.
  • fDeleteFile
    [in] Value specifying if the method should delete the file. Set this value to TRUE to delete the file, and to FALSE otherwise.

Return Values

The following table shows the possible return values.

Value Description
S_OK Function completed successfully.
E_INVALIDARG pszKeyName is invalid or bad.
SPERR_UNINITIALIZED Either the data key or token delegate interface is not initialized.
SPERR_TOKEN_DELETED Key has been deleted.
FAILED(hr) Appropriate error message.

Example

The following code snippet creates a test file, removes it, and manually deletes it. It may also be deleted automatically by setting fDeleteFile to TRUE.

HRESULT hr;
GUID guid0;
CComPtr cpSpObjectToken;
CComPtr cpSpObjectWithToken;
CSpCoTaskMemPtr cpFileName;
hr = SpGetDefaultTokenFromCategoryId(SPCAT_VOICES, &cpSpObjectToken);
//Check return value
ZeroStruct(guid0);
// Create subkeys and value item to be deleted
hr = cpSpObjectToken->GetStorageFileName(
guid0, L"test file", NULL, CSIDL_FLAG_CREATE|CSIDL_APPDATA, &cpFileName
);
if (SUCCEEDED(hr))
{
  hr = cpSpObjectToken->RemoveStorageFileName(guid0, L"test file", false);
  //Check return value
  cpFileName.Clear();
}

Requirements

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

See Also

ISpObjectToken | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.