How to use the function GetStorageFileName for adding training files to registry?

对着背影说爱祢 提交于 2019-12-02 02:37:21

ISpObjectToken::GetStorageFileName isn't the best documented API in the world. Luckily, I have some worked examples to help improve the documentation.

clsidCaller

Set this if you need the file name associated with the object token. For training, this should be CLSID_NULL. (If you're updating engine-related data, then it would be the CLSID of the engine.)

pszValueName

The name of the registry subkey to store the filename in. For training, this should be L"TrainingAudio-<locale>", where locale should be the 4 digit locale ID for the engine.

pszFileNameSpecifier

The name of the file to be created.

If this starts with "X:\" or "\" it is assumed to be a full path.

Otherwise it is assumed to be relative to the special folder ID given in the nFolder parameter.

If pszFileNameSpecifier ends with a '\', or is NULL a unique file name will be created.

If the name contains a %d the %d is replaced by a number to give a unique file name.

For training, you should specify something like L"TrainingAudio\\TR_%d.wav".

nFolder

A CSIDL value that identifies the folder whose path is to be retrieved. The user can force the creation of a folder by combining the folder's CSIDL with CSIDL_FLAG_CREATE. If pszFileNameSpecifier is NULL or "\", nFolder must have a specified CSIDL folder combined with CSIDL_FLAG_CREATE if the user wants to force to create the file.

For training, this should be CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE.

ppszFilePath

Address of a pointer to the null-terminated string that receives the file path information. Use CoTaskMemFree to release the string when done.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!