ISpRecoGrammar::GetGrammarState (Windows CE 5.0)

Send Feedback

This method gets the current state of the recognition grammar. See also ISpRecoGrammar::SetGrammarState.

HRESULT GetGrammarState(SPGRAMMARSTATE* peGrammarState);

Parameters

  • peGrammarState
    [out] Pointer to a value indicating the state of the grammar. Possible values are defined for the SPGRAMMARSTATE enumeration. The default grammar state is SPGS_ENABLED.

Return Values

The following table shows the possible return values.

Value Description
S_OK Function completed successfully.
E_POINTER One of the pointers is invalid or bad.
FAILED(hr) Appropriate error message.

Example

The following code snippet illustrates the use of this method to query the default state of a grammar object implementing ISpRecoGrammar.

HRESULT hr = S_OK;
// create a new grammar object
hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar);
// Check hr
// query the default grammar state
hr = cpRecoGrammar->GetGrammarState(&grammarState);
// Check hr
// ASSERT that grammarState == SPGS_ENABLED

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapi.h, Sapi.idl.
Link Library: Sapilib.lib.

See Also

ISpRecoGrammar | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.