Share via


ISpPhraseBuilder::InitFromPhrase

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This method initializes the phrase being built from the specified phrase.

Syntax

HRESULT InitFromPhrase(
  const SPPHRASE* pSrcPhrase
);

Parameters

  • pSrcPhrase
    [in] Pointer to an SPPHRASE structure containing a phrase from which to initialize. If this parameter is NULL, the phrase builder resets the phrase being built to its initial state.

Return Value

The following table shows the possible return values.

Value Description

S_OK

Function completed successfully.

E_INVALIDARG

Provided SPPHRASE structure or the member Rule.pNextSibling is invalid or bad. Alternatively, SPPHRASE.LangID can be zero, or SPPHRASE.cbSize is not correct for the phrase being built.

FAILED(hr)

Appropriate error message.

Example

The following code snippet demonstrates creating and initializing from a phrase.

HRESULT hr;
CComPtr<ISpPhraseBuilder> cpPhraseBuilder;
CComPtr<ISpPhrase>        cpPhrase;
SPPHRASE    Phrase;
hr = cpPhraseBuilder.CoCreateInstance( CLSID_SpPhraseBuilder );
if (SUCCEEDED(hr))
{
    //Initialize the Phrase data structure 
}
if (SUCCEEDED(hr))
{
    hr = cpPhraseBuilder->InitFromPhrase( &Phrase );
}

Requirements

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

See Also

Reference

ISpPhraseBuilder
SAPI Interfaces