ISpRecognizer::DisplayUI (SAPI 5.4)

Microsoft Speech API 5.4


ISpRecognizer::DisplayUI displays the requested UI component from the underlying SR engine.

    [local] HRESULT DisplayUI(
   HWND           hwndParent,
   LPCWSTR       *pszTitle,
   LPCWSTR       *pszTypeOfUI,
   void          *pvExtraData,
   ULONG          cbExtraData


  • hwndParent
    [in] Specifies the handle of the parent window.
  • pszTitle
    [in] Address of a null-terminated string containing the window title. Set this value to NULL to indicate that the SR engine should use its default window title for this UI type. 
  • pszTypeOfUI
    [in] Address of a null-terminated string containing the UI type information.
  • pvExtraData
    [in] Additional information for the call. The SR engine implementer dictates the format and use of the data provided.
  • cbExtraData
    [in] Size, in bytes, of the contents of pvExtraData. The SR engine implementer dictates the format and usage of the data provided.

Return values



The current Microsoft SR engine does not send this event.

SAPI 5 speech recognition engines are capable of sending UI requests back to the application using SPEI_REQUEST_UI. For example, if the SR engine is receiving a poor audio input signal, it may request the user to perform Microphone Training (see SPDUI_MicTraining). The application can receive these requests by calling ISpRecognizer::SetInterest with SPEI_REQUEST_UI. When the UI request is received, it can call ISpRecognizer::DisplayUI at an appropriate point. The typical SR engine UI requests could be User Training (see SPDUI_UserTraining), Microphone Training (see SPDUI_MicTraining), and Lexicon Updates (see SPDUI_AddRemoveWord). An application can call DisplayUI at any time, and does not necessarily have to wait for a UI request from the SR engine.

To best apply ISpRecognizer::DisplayUI, call ISpRecognizer::IsUISupported with a specific UI type before calling DisplayUI. (see the SR Engine Guide for further information on how an SR engine should implement UI.

The call to DisplayUI is synchronous, so the call will not return until the UI has been closed.