ISpContainerLexicon::AddLexicon

Microsoft Speech SDK

The Microsoft.com Speech website Microsoft Speech SDK SAPI 5.1

ISpContainerLexicon::AddLexicon

ISpContainerLexicon::AddLexicon adds a lexicon and its type to the lexicon stack. Mainly used by engines to add private lexicons to their instance of the container lexicon for consistency of lexicon access.

HRESULT AddLexicon(
   ISpLexicon   *pAddLexicon,
   DWORD         dwFlags
);

Parameters

pAddLexicon
[in] Pointer to the lexicon to be added.
dwFlags
[in] flags of type SPLEXICONTYPE indicating the lexicon type. Should use exactly one of the types from eLEXTYPE_PRIVATE1 through eLEXTYPE_PRIVATE20.

Return values

Value Description
S_OK Function completed successfully.
E_INVALIDARG Either dwFlag is invalid or bad, or the lexicon could not be added.
SPERR_ALREADY_INITIALIZED Attempted to add either the user or application.
E_POINTER pAddLexicon is invalid or bad.
E_OUTOFMEMORY Exceeded available memory.
FAILED(hr) Appropriate error message.

Remarks

For an application to create a new application lexicon, calling AddLexicon for the new lexicon on the application's instance of the container lexicon will not update the engine's instance of the container lexicon. The correct way to update an instance of the container lexicon is to release it and recreate the object. At this point it will re-enumerate all available application lexicons. To guarantee an update of the engine's instance of the container lexicon, the engine must be released and recreated, at which point it will recreate its instance of the container lexicon.