Microsoft Speech SDK
SAPI 5.1
ISpObjectToken::RemoveStorageFileName
ISpObjectToken::RemoveStorageFileName removes the object token file name.
HRESULT RemoveStorageFileName(
REFCLSID clsidCaller,
const WCHAR *pszKeyName,
BOOL fDeleteFile
);
Parameters
- clsidCaller
- [in] Globally unique identifier (GUID) of the calling object.
- pszKeyName
- [in] Address of a null-terminated string containing the registry key name.
- fDeleteFile
- [in] Value specifying if the file should be deleted. TRUE deletes the file afterward; FALSE does not.
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 have been deleted automatically by setting fDeleteFile to TRUE.
HRESULT hr;
GUID guid0;
CComPtr<ISpObjectToken> cpSpObjectToken;
CComPtr<ISpObjectWithToken> cpSpObjectWithToken;
CSpCoTaskMemPtr<WCHAR> 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();
}