You are reading help file online using chmlib.com
|
ISpTokenUI::DisplayUI displays the UI associated with the object token.
[local] HRESULT DisplayUI(
HWND hwndParent,
const WCHAR *pszTitle,
const WCHAR *pszTypeOfUI,
void *pvExtraData,
ULONG cbExtraData,
ISpObjectToken *pToken,
IUnknown *punkObject
);
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. |
The best-practice for using ISpTokenUI is to call ISpTokenUI::IsUISupported with a specific UI type before calling DisplayUI.
The call to DisplayUI is synchronous, so the call will not return until the UI has been closed.
The token may require extra functionality that only it understands in order to display a particular piece of UI. Common implementation practice for accessing this functionality is to use QueryInterface of a known IUnknown interface or create the object associated a known ISpObjectToken instance. The caller of ISpTokenUI::DisplayUI can set punkObject with the necessary IUnknown interface or set pToken with the necessary ISpObjectToken interface. For example, asking to display Speech Recognition Training UI requires that a specific SR engine be used.
The following code snippet illustrates the use of ISpTokenUI::DisplayUI using SPDUI_AudioVolume.
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 default audio input object has UI for volume
hr = cpTokenUI->IsUISupported(SPDUI_AudioVolume, NULL, NULL, NULL, &fSupported);
// Check hr
// if fSupported == TRUE, then default audio input object has UI for Volume
// Display the default audio input object's Volume UI
hr = cpTokenUI->DisplayUI(MY_HWND, MY_AUDIO_DIALOG_TITLE, SPDUI_AudioVolume, NULL, NULL, cpObjectToken, NULL);
// Check hr
You are reading help file online using chmlib.com
|