Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SpeechRecognizer CreateRecoContext Method (SAPI 5.3)

Speech API 5.3
Microsoft Speech API 5.3

Interface: ISpeechRecognizer

CreateRecoContext Method

The CreateRecoContext method creates a recognition context object from the recognizer.

SpeechRecognizer.CreateRecoContext() As ISpeechRecoContext



Return Value

The CreateRecoContext method returns an ISpeechRecoContext object.


The following Visual Basic form code demonstrates the use of CreateRecoContext.

To run this code, create a form without any controls. Copy this code and paste it into the Declarations section of the form.

Option Explicit

Private Sub Form_Load()
    On Error GoTo EH

    Dim myContext As ISpeechRecoContext
    Dim SharedRecognizer As SpSharedRecognizer

    Set SharedRecognizer = New SpSharedRecognizer
    Set myContext = SharedRecognizer.CreateRecoContext
    MsgBox myContext.State, vbInformation

    If Err.Number Then ShowErrMsg
End Sub

Private Sub ShowErrMsg()

    ' Declare identifiers:
    Dim T As String

    T = "Desc: " & Err.Description & vbNewLine
    T = T & "Err #: " & Err.Number
    MsgBox T, vbExclamation, "Run-Time Error"

End Sub
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.