ISpTokenUI::IsUISupported

Microsoft Speech SDK

The Microsoft.com Speech website Microsoft Speech SDK SAPI 5.1

ISpTokenUI::IsUISupported

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

[local] HRESULT IsUISupported(
   const WCHAR   *pszTypeOfUI,
   void          *pvExtraData,
   ULONG          cbExtraData,
   IUnknown      *punkObject,
   BOOL          *pfSupported
);

Parameters

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

Value Description
S_OK Function completed successfully.
S_FALSE The UI is supported but not with the current run-time environment or parameters.
E_INVALIDARG One or more parameters are invalid.
E_POINTER Invalid or bad pointer.
FAILED(hr) Error returned by UI object.

Remarks

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.

Example

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

    HRESULT hr = S_OK;

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

    // get the object token's UI
    hr = cpObjectToken->QueryInterface(&cpTokenUI);
    // Check hr

    // check if the default audio input object has UI for Properties 
    hr = cpTokenUI->IsUISupported(SPDUI_AudioProperties, NULL, NULL, NULL, &fSupported);
    // Check hr

    // if fSupported == TRUE, then default audio input object has UI for Properties