Note
Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.
Microsoft Speech Platform
ISpObjectToken::RemoveStorageFileName
ISpObjectToken::RemoveStorageFileName removes the object token file name.
<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT RemoveStorageFileName(</strong> <strong> REFCLSID</strong> <em>clsidCaller</em>, <strong> LPCWSTR </strong> *<em>pszKeyName</em>, <strong> BOOL</strong> <em>fDeleteFile</em> <strong>);</strong> </pre>
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
fDeleteFile
`
// 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->RemoveStorageFileName(guid0, L"TestFile", false); }
if (SUCCEEDED(hr)) { // Do stuff here. }