Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Microsoft Speech API 5.3
ISpRecoGrammar::GetGrammarState
ISpRecoGrammar::GetGrammarState retrieves the current state of the recognition grammar.
The default grammar state is SPGS_ENABLED.
See also ISpRecoGrammar::SetGrammarState
HRESULT GetGrammarState(SPGRAMMARSTATE *peGrammarState
);
Parameters
- peGrammarState
[out] Address of the SPGRAMMARSTATE enumeration that receives the grammar state information.
Return values
Value |
S_OK |
E_POINTER |
FAILED(hr) |
Example
The following code snippet illustrates the use of ISpRecoGrammar::GetGrammarState to query the default state of an SpRecoGrammar object.
// Declare local identifiers:
HRESULT hr = S_OK;
CComPtr<ISpRecoGrammar> cpRecoGrammar;
CComPtr<ISpRecoContext> cpRecoContext;
ULONGLONG ullGrammarId = 0;
SPGRAMMARSTATE grammarState;
// Create a new grammar object.
hr = cpRecoContext->CreateGrammar(ullGrammarId, &cpRecoGrammar;);
if (SUCCEEDED(hr))
{
// Query the default grammar state.
hr = cpRecoGrammar->GetGrammarState(&grammarState;);
}
if (SUCCEEDED(hr))
{
// ASSERT that grammarState = SPGS_ENABLED.
}