ISpTokenUI

Microsoft Speech SDK

The Microsoft.com Speech website Microsoft Speech SDK SAPI 5.1

ISpTokenUI

Provides developers with a means to programmatically manage user-interface associated with an ISpObjectToken.

When To Implement

The ISpTokenUI interface should be implemented so that the object can allow other applications to display the UI. For example, an SR engine (see ISpRecognizer) has a UI for Training (see SPDUI_UserTraining), and it would be helpful for an application to be able to display the Training UI as appropriate.

Example

The following code snippet illustrates the use of ISpTokenUI using QueryInterface.

    HRESULT hr = S_OK;

    // find the preferred multimedia input object token
    hr = SpFindBestToken(SPCAT_AUDIOIN, L"Technology=MMSys", NULL, &cpObjectToken);
    // Check hr

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

The following code snippet illustrates the use of ISpTokenUI using CoCreateInstance. The user must know the exact CLSID of the intended UI object.

    HRESULT hr = S_OK;

    // create the Token UI for the UI object CLSID_MY_TOKEN_UI
    hr = cpTokenUI.CoCreateInstance(CLSID_MY_TOKEN_UI);
    // Check hr

Methods in Vtable Order

ISpTokenUI Methods Description
IsUISupported Determines if the specified UI type is supported by the token.
DisplayUI Displays the UI associated with the object token.

Development Helpers

Helper Functions Description
SpCreateBestObject Creates the most appropriate object based on specific criteria.
SpFindBestToken Finds the most appropriate IspObjectToken based on specific criteria.
SpCreateObjectFromToken Creates an object based on a specified ISpObjectToken.
SpCreateDefaultObjectFromCategoryId Creates the default object from a specific category.
SpGetTokenFromId Creates an ISpObjectToken based on a token id.
SpGetDefaultTokenFromCategoryId Creates the default ISpObjectToken from a specific category.