Share via


ISpPhrase::GetPhrase (Windows Embedded CE 6.0)

1/6/2010

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

Syntax

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 Value

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

Header sapi.h, sapi.idl
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

ISpPhrase
SAPI Interfaces