ISRGramCFG::ListSet

HRESULT ListSet(TCHAR *pszListName, SDATA dWord);

Fills in an empty list field in a grammar, or replaces an existing list.

· Returns NOERROR if successful, or one of these error values:

E_INVALIDARG
E_OUTOFMEMORY
SRERR_INVALIDCHAR
SRERR_INVALIDLIST
SRERR_NOTENOUGHDATA
SRERR_NOTSUPPORTED

pszListName

[in] Address of a buffer that contains the name of the list. If the list is already set for the grammar, the old list is discarded and the new list is loaded. If the list name is not valid for the grammar, an error is returned.

dWord

[in] An SDATA structure that contains a sequential list of SRWORD structures. (This is not an array because the size of each structure varies according to its contents.) The number of SRWORD structures is determined by the dwSize member of the SDATA structure.

The list provides the identified words. If a word from the list is spoken, the engine returns its word identifier just as if the word had been precompiled into the grammar.

A list can be used to "fill in the blanks" in a grammar with information that changes frequently, such as filenames or other entries. For example, a grammar might provide the sentence "Send mail to Names-List." For this sentence to be recognized correctly, the application should call the ListSet member function using Names-List and specify a list of e-mail names.

ListSet can be called at any time, and the newly set list takes effect immediately. Because of this flexibility, recognizing speech based on a list may be slower than a precompiled grammar and should be used only when precompiling is impossible.

If the engine does not support lists, it returns SRERR_NOTSUPPORTED.