ISpTokenUI::IsUISupported (SAPI 5.4)

Microsoft Speech API 5.4


ISpTokenUI::IsUISupported determines if the specified UI type is supported by the token.

    [local] HRESULT IsUISupported(
   LPCWSTR       *pszTypeOfUI,
   void          *pvExtraData,
   ULONG          cbExtraData,
IUnknown      *punkObject,
   BOOL          *pfSupported


  • pszTypeOfUI
    [in] Address of a null-terminated string containing the object's UI type.
  • pvExtraData
    [in] Pointer to additional information needed for the object. The ISpTokenUI object implementer dictates the format and usage of the data provided.
  • cbExtraData
    [in] Size, in bytes, of the ExtraData. The ISpTokenUI object implementer dictates the format and usage of the data provided.
  • punkObject
    [in] Address of the object's IUnknown interface. See Remarks section.
  • pfSupported
    [out] Address of a variable that receives the value indicating support for the interface. This value is set to TRUE when this interface is supported and FALSE otherwise. If this value is TRUE, but the return code is S_FALSE, the UI type (pszTypeOfUI) is supported, but not with the current parameters or run-time environment. Check with the implementer of the UI object to verify run-time requirements.

Return values



When asking a token to display a particular piece of UI, the token may require extra functionality that only it understands. Common implementation practice for accessing this functionality is to QueryInterface off of a known IUnknown interface. The caller of ISpTokenUI::IsUISupported can set the punkObject parameter with the necessary IUnknown interface. For example, asking to display Speech Recognition Training UI requires that a specific SR engine be used.


The following code snippet illustrates the use of ISpTokenUI::IsUISupported using SPDUI_AudioProperties.

// Declare local identifiers:
HRESULT                      hr = S_OK;
CComPtr<ISpTokenUI>          cpTokenUI;
CComPtr<ISpObjectToken>      cpObjectToken;
BOOL                         fSupported;

// Get the default input audio object token.
hr = SpGetDefaultTokenFromCategoryId(SPCAT_AUDIOIN, &cpObjectToken;);

if (SUCCEEDED(hr))
   // Get the object token's UI.
   hr = cpObjectToken->QueryInterface(&cpTokenUI;);
if (SUCCEEDED(hr))
   // Check if the default audio input object has UI for Properties.
   hr = cpTokenUI->IsUISupported(SPDUI_AudioProperties, NULL, NULL, NULL, &fSupported;);

if (SUCCEEDED(hr))
   // If fSupported == TRUE, then default audio input
   // object has UI for Properties; so, do stuff here.