Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ISpTokenUI (SAPI 5.3)

Speech API 5.3
Microsoft Speech API 5.3


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.


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

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

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

if (SUCCEEDED(hr))
   // Get the multimedia object token's UI.
   hr = cpObjectToken->QueryInterface(&cpTokenUI;);
if (SUCCEEDED(hr))
   // Do stuff here.

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

// Declare local identifiers:
HRESULT                    hr = S_OK;
CComPtr<ISpTokenUI>        cpTokenUI;
GUID                       rguidParam;

// Create the Token UI for the UI object (rguidParam must
// be assigned the exact CLSID of the intended UI object).
hr = cpTokenUI.CoCreateInstance(rguidParam);

if (SUCCEEDED(hr))
   // Do something here.

Methods in Vtable Order

ISpTokenUI MethodsDescription
IsUISupportedDetermines if the specified UI type is supported by the token.
DisplayUIDisplays the UI associated with the object token.

Development Helpers

Helper FunctionsDescription
SpCreateBestObjectCreates the most appropriate object based on specific criteria.
SpFindBestTokenFinds the most appropriate IspObjectToken based on specific criteria.
SpCreateObjectFromTokenCreates an object based on a specified ISpObjectToken.
SpCreateDefaultObjectFromCategoryIdCreates the default object from a specific category.
SpGetTokenFromIdCreates an ISpObjectToken based on a token id.
SpGetDefaultTokenFromCategoryIdCreates the default ISpObjectToken from a specific category.
© 2015 Microsoft