Share via


SpeechRecoContext RequestedUIType Property (SAPI 5.3)

Microsoft Speech API 5.3

Interface: ISpeechRecoContext

RequestedUIType Property

The RequestedUIType property specifies the UIType of the last UI requested from the engine.

After a speech recognition (SR) engine sends a RequestUI event, the UIType persists until the next RequestUI event. This way the application can check for the last requested UI type. If no UI has been requested, the UIType string will be Empty.

Syntax

Set: (This property is read-only)
Get: String = SpeechRecoContext.RequestedUIType

Parts

  • SpeechRecoContext
    The owning object.
  • String
    Set: (This property is read-only)
    Get: A String variable specifying the UIType. The UIType is a String corresponding to the UI requested. For a list of available SAPI 5 UI, see Engine User Interfaces.

Remarks

See RequestUI event, ISpeechRecognizer.DisplayUI, and Engine User Interfaces for more information.

Example

The following Visual Basic form code demonstrates retrieving the UI last requested from the engine. Due to the complexity of replicating a RequestUI, the UI this code retrieves is a zero-length string. To run this code, paste it into the Declarations section of a form that contains no controls.

  
Option Explicit

Private Sub Form_Load()

    Dim RecoContext As SpInProcRecoContext
    Dim T As String
    Dim UI As String

    On Error GoTo EH

    Set RecoContext = New SpSharedRecoContext
    UI = RecoContext.RequestedUIType

    If Len(UI) = 0 Then
        T = "No user interface type has been requested by the engine."
        MsgBox T, vbInformation
    End If

    End

EH:
    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

End Sub