다음을 통해 공유


ISpRecoGrammar::GetGrammarState (Windows Embedded CE 6.0)

1/6/2010

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

Syntax

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 Value

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

Header sapi.h, sapi.idl
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

ISpRecoGrammar
SAPI Interfaces