다음을 통해 공유


ISpPhrase::GetPhrase (Windows CE 5.0)

Send Feedback

This method gets data elements associated with a phrase. The memory containing the data elements is allocated with a call to CoTaskMemAlloc.

HRESULT GetPhrase(SPPHRASE** ppCoMemPhrase);

Parameters

  • ppCoMemPhrase
    [out] Address of a pointer to an SPPHRASE structure containing the phrase information, or to NULL if no phrase is recognized. If the value is NULL, no memory is allocated for the structure. It is the caller's responsibilty to call CoTaskMemFree to free the structure. However, the caller does not need to call CoTaskMemFree on each of the SPPHRASE members.

Return Values

The following table shows the possible return values.

Value Description
S_OK Function completed successfully.
E_POINTER Invalid pointer.
E_OUTOFMEMORY Exceeded available memory.

Returned data includes all elements associated with this phrase.

Example

The following code snippet illustrates the use of this method as inherited from ISpPhrase to retrieve the recognized text, and display the rule recognized and the phrase.

HRESULT hr = S_OK;
// ... obtain a recognition result object from the recognizer...
// get the recognized phrase object
hr = cpRecoResult->GetPhrase(&pPhrase);
// Check hr
// get the phrase's text
hr = pPhrase->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &pwszText,
NULL);
// Check hr
// display the recognized text and the rule name in a message box
MessageBoxW(MY_HWND, pwszText, pPhrase->Rule.pszName, MB_OK);

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapi.h, Sapi.idl.
Link Library: Sapilib.lib.

See Also

ISpPhrase | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.