ISpeechRecoGrammar State Property

Microsoft Speech SDK

Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Interface: ISpeechRecoGrammar

State Property


The State property gets and sets the operational status of the speech grammar.

The status consists of a SpeechGrammarState constant; its three states can be summarized as enabled, disabled, and exclusive.

Syntax

Set: ISpeechRecoGrammar.State = SpeechGrammarState
Get: SpeechGrammarState = ISpeechRecoGrammar.State

Parts

ISpeechRecoGrammar
The owning object.
SpeechGrammarState
Set: A SpeechGrammarState constant that sets the property.
Get: A SpeechGrammarState constant that gets the property.

Example

The following code snippet demonstrates the use of the State property. The grammar is disabled while the CmdLoadFromFile method loads the grammar, and enabled when the load has completed.


Dim C As SpeechLib.SpSharedRecoContext
Dim G As SpeechLib.ISpeechRecoGrammar

Set C = New SpSharedRecoContext
Set G = C.CreateGrammar()

'
'
'

G.State = SGSDisabled       'Disable grammar while loading

G.CmdLoadFromFile ("c:\sol.xml")

G.State = SGSEnabled        'Re-enable when done loading