Share via


SpeechRecoContext RequestUI Event (SAPI 5.3)

Microsoft Speech API 5.3

Interface: ISpeechRecoContext Events

RequestUI Event

The RequestUI event occurs when the speech recognition (SR) engine requests additional information from the user.

Though not required, SR engines may employ a process improvement procedure and request additional information from the user. For example, if the recognition attempts are consistently poor or if the engine detects consistent background interference, the SR engine could request that the application use the training or microphone wizard. This event is a suggestion by the SR engine to run the particular UI. The application may choose to initiate the UI or may ignore the request.

  
    SpeechRecoContext.RequestUI(
     StreamNumber As Long,
     StreamPosition As Variant,
     UIType As String
)

Parameters

  • StreamNumber
    Specifies the stream number.
  • StreamPosition
    Specifies the position within the stream.
  • UIType
    Specifies 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 ISpeechRecognizer.DisplayUI and ISpeechRecognizer.IsUISupported for additional information.

Example

The following Visual Basic code shows a typical RequestUI event. Since the SR engine initiates the call, reproducing the event is difficult. However, if the application receives this event, the code displays the user training wizard. It is the same training wizard that is available through the Speech properties in Control Panel.

  Private Sub RC_RequestUI(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal UIType As String)
    If UIType = SpeechUserTraining Then
        RC.Recognizer.DisplayUI Form1.hWnd, "My User Training", SpeechUserTraining, vbNullString
    End If
End Sub