SpeechRecognizer IsUISupported Method (Microsoft Speech Platform)

Microsoft Speech Platform SDK 11

Microsoft Speech Platform

Interface: ISpeechRecognizer

IsUISupported Method

The IsUISupported method determines if the specified UI is supported.

The speech recognition (SR) and text-to-speech (TTS) engines are capable of displaying and running various user interfaces (UI). These displays assist with different aspects of the speech environment such as user training, microphone wizards, adding and removing words, or setting controls for the engine. Many of these UIs are available using Speech properties in Control Panel. In addition, the engines are capable of requesting that specific UIs are run to improve a situation. For example, the SR could request more user training if the recognitions are consistently poor.

Engines are not required to support UI and not all engines will have the same UI. Consult the manufacturer's engine documentation for specific details. An application may call ISpeechRecognizer.IsUISupported before attempting to invoke a particular UI to see if the engine supports it. Invoking unsupported UIs will cause a run-time error. If the UI is available, use ISpeechRecognizer.DisplayUI to invoke the display.


SpeechRecognizer.IsUISupported(
     TypeOfUI As String,
     [ExtraData As Variant = Nothing]
) As Boolean

Parameters

TypeOfUI
A String specifying the name of the UI to display.
ExtraData
[Optional] Specifies the ExtraData. This information is unique to the application and may be used to provide additional or more specific information to the UI. By default the Nothing value is used and indicates the UI does not use any additional information provided by this method.

Return Value

The IsUISupported method returns a Boolean variable.


Remarks

See ISpeechRecognizer.DisplayUI and ISpeechRecoContext.RequestUI for additional information.

Example

The following Visual Basic form code demonstrates the use of the IsUISupported method. The application attempts to run two UIs. The first is the training wizard (the same one available using Speech properties in Control Panel) and the second UI is a nonexistent one called MyApp.

To run this code, create a form without any controls. Paste this code into the Declarations section of the form.


Option Explicit

Dim RC As SpSharedRecoContext
Private Sub Command1_Click()

    RunUI SpeechUserTraining
    RunUI "MyApp"

End Sub

Private Sub Form_Load()
    On Error GoTo EH

    Set RC = New SpSharedRecoContext

EH:
    If Err.Number Then ShowErrMsg
End Sub

Private Function RunUI(theUI As String)
    On Error GoTo EH

    Const Title = "My App's Additional Training"
    Dim T As String

    If RC.Recognizer.IsUISupported(theUI) = True Then
        RC.Recognizer.DisplayUI Form1.hWnd, Title, theUI, ""
        T = theUI & " UI is supported."
    Else
        T = theUI & " UI is not supported."
    End If

    MsgBox T, vbInformation

EH:
    If Err.Number Then ShowErrMsg
End Function

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

End Sub