Share via


ISpTokenUI (SAPI 5.4)

Microsoft Speech API 5.4

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.

  
// 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 Methods
IsUISupported
DisplayUI

Development Helpers

Helper Functions
SpCreateBestObject
SpFindBestToken
SpCreateObjectFromToken
SpCreateDefaultObjectFromCategoryId
SpGetTokenFromId
SpGetDefaultTokenFromCategoryId