ISpTokenUI (SAPI 5.3)
Speech API 5.3
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 | 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. |