CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Interface: ISpeechRecoGrammar

DictationSetState Method


The DictationSetState method sets the dictation topic state.


ISpeechRecoGrammar.DictationSetState(
     State As SpeechRuleState
)

Parameters

State
A SpeechRuleState constant that specifies the dictation topic state.

Return Value

None.


Example

The following Visual Basic form code demonstrates the use of the DictationLoad, DictationSetState, and DictationUnload methods. It creates a grammar, configures the grammar to perform both dictation and command and control (C and C) recognition, and toggles between the two types of recognition.

To run this code, create a form with the following control:

  • A command button called Command1
  • Paste this code into the Declarations section of the form.

    The Form_Load procedure creates a grammar object, associates it with the system dictation lexicon and the Solitaire C and C grammar, and begins recognition in dictation mode. The Command1_Click procedure toggles the recognition mode between dictation and C and C. The Form_Unload procedure unloads the dictation grammar and deactivates the C and C grammar.


    Option Explicit
    
    Dim C As SpeechLib.SpSharedRecoContext
    Dim G As SpeechLib.ISpeechRecoGrammar
    
    Private Sub Command1_Click()
    
        If Command1.Caption = "&Dictation" Then
            G.CmdSetRuleIdState 0, SGDSInactive     'C&C off
            G.DictationSetState SGDSActive          'Dictation on
            Command1.Caption = "&C and C"
        Else
            G.DictationSetState SGDSInactive        'Dictation off
            G.CmdSetRuleIdState 0, SGDSInactive     'C&C on
            Command1.Caption = "&Dictation"
        End If
    
    End Sub
    
    Private Sub Form_Load()
    
        'Create a RecoContext and its Grammar
        Set C = New SpSharedRecoContext
        Set G = C.CreateGrammar
        
        'Get dictation grammar and set it inactive
        G.DictationLoad "", SLOStatic
        G.DictationSetState SGDSInactive
        
        'Get Command & Control grammar, and set it inactive
        G.CmdLoadFromFile "C:\SOL.XML", SLOStatic
        G.CmdSetRuleIdState 0, SGDSInactive
        
        'Set dictation active and set up Command1.Caption
        G.DictationSetState SGDSActive
        Command1.Caption = "&C and C"
    
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        G.DictationUnload
        G.CmdSetRuleIdState 0, SGDSInactive
    End Sub


    You are reading help file online using chmlib.com

    If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
    Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web