Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Microsoft Speech Platform

ISpRecoGrammar::LoadCmdFromFile

ISpRecoGrammar::LoadCmdFromFile loads a grammar from a file. The file can either be a compiled or uncompiled grammar file. To modify the rules of the grammar after it has been loaded, specify SPLO_DYNAMIC for the Options parameter, otherwise specify the SPLO_STATIC flag.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT LoadCmdFromFile(</strong> <strong>LPCWSTR</strong> *<em>pszFileName</em>, <a runat="server" href="jj127470(v=msdn.10).md"><strong>SPLOADOPTIONS</strong></a> <em>Options</em> <strong>);</strong> </pre>

Parameters

  • pszFileName
    [in, string] The name of the file containing the command and control grammar. The Speech Platform supports loading of compiled and static grammars using URL.
  • Options
    [in] Flag of type SPLOADOPTIONS indicating whether the grammar will be modified dynamically.

Return Values

Value Description
S_OK Function completed successfully.
E_INVALIDARG pszFileName is invalid or bad. Alternatively, Options is neither SPLO_STATIC nor SPLO_DYNAMIC.
FAILED(hr) Appropriate error message.

Remarks

When an application calls ::LoadCmdFromFile, the currently loaded CFG will be unloaded.