::IsUISupported
ISpObjectToken::IsUISupported
determines if the user interface (UI) associated with the object is supported.
Ultimately, ISpObjectToken::IsUISupported is similar to creating an ISpTokenUI object and calling ISpTokenUI::ISpIsUISupported.
[local] HRESULT IsUISupported(
LPCWSTR *pszTypeOfUI,
void *pvExtraData,
ULONG cbExtraData,
IUnknown *punkObject,
BOOL *pfSupported
);
파라미터
반환 값
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 of the parameters is invalid or bad. |
SPERR_UNINITIALIZED | Either the data key or token delegate interface is not initialized. |
SPERR_TOKEN_DELETED | Key has been deleted. |
FAILED(hr) | Appropriate error message. |
주의
pvExtraData and punkObject Parameters: When asking an ISpObjectToken to display a particular piece of UI, the UI object may require extra functionality that only it understands. Common implementation practice for accessing this functionality is to QueryInterface off of a known IUnknown interface. The caller of ISpTokenUI::IsUISupported can set the punkObject parameter with the necessary IUnknown interface. For example, to display a Speech Recognition Training UI (see SPDUI_UserTraining) requires a specific SR engine.
예제
The following code snippet illustrates the use of ISpObjectToken::IsUISupported using SPDUI_EngineProperties.
// Declare local identifiers:
HRESULT hr = S_OK;
CComPtr<ISpObjectToken> cpObjectToken;
CComPtr<ISpVoice> cpVoice;
BOOL fSupported;
HWND hwndParent;
// Get the default text-to-speech engine object token.
hr = SpGetDefaultTokenFromCategoryId(SPCAT_VOICES, &cpObjectToken;);
if (SUCCEEDED(hr))
{
// Create the engine object based on the object token.
hr = SpCreateObjectFromToken(cpObjectToken, &cpVoice;);
}
if (SUCCEEDED(hr))
{
// Check if the default engine object has UI for Properties.
hr = cpObjectToken->IsUISupported(SPDUI_EngineProperties, NULL, NULL, cpVoice, &fSupported;);
}
if (SUCCEEDED(hr))
{
// If default engine object has UI for
// Engine Properties, display UI--
if (fSupported == TRUE)
{
hr = cpObjectToken->DisplayUI(hwndParent, L"My App's Caption", SPDUI_EngineProperties, NULL, NULL, cpVoice);
}
}
if (SUCCEEDED(hr))
{
// Do stuff here.
}
참고자료
http://msdn.microsoft.com/en-us/library/ms718255(VS.85).aspx
이 글은 스프링노트에서 작성되었습니다.