Share via


Note

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

Microsoft Speech Platform

ISpRecoContext::SetContextState

ISpRecoContext::SetContextState sets the state of the recognition context.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT SetContextState(</strong><a runat="server" href="jj127457(v=msdn.10).md"><strong>SPCONTEXTSTATE</strong></a> <em>eContextState</em> <strong>);</strong> </pre>

Parameters

  • eContextState
    [in] The SPCONTEXTSTATE enumeration sequence specifying the recognition context state.

Return Values

Value Description
S_OK Function completed successfully.
E_INVALIDARG eContextState is not one of the correct types.
FAILED(hr) Appropriate error message.

Remarks

The default recognition context state for an ISpRecoContext object is SPCS_ENABLED.

Applications can use ISpRecoContext::SetContextState to toggle sets of grammars. For example, a multi-document interface application that uses a different ISpRecoContext object for each document could toggle the context states as each document gained and lost the focus.  

Applications can use ISpRecoContext::GetContextState to query the context state.