You are reading help file online using chmlib.com
|
ISpLexicon::GetWords gets a list of all words in the lexicon.
HRESULT GetWords(
DWORD dwFlags,
DWORD *pdwGeneration,
DWORD *pdwCookie,
SPWORDLIST *pWordList
);
Value | Description |
---|---|
S_OK | Function completed successfully. |
S_FALSE | Additional words are left in the lexicon(s) to process. |
SPERR_LEX_REQUIRES_COOKIE | A complete list of words cannot be returned at once from the container lexicon. pdwCookie must not be NULL. |
E_POINTER | At least one of pdwGeneration, pdwCookie, pWordList is not valid. Alternatively, the block of memory is too small or is not writable. |
E_INVALIDARG | At least one of the parameters is not valid. |
E_OUTOFMEMORY | Exceeded available memory. |
SPERR_UNINITIALIZED | Interface not initialized. |
FAILED(hr) | Appropriate error message. |
This method is called repeatedly with the cookie (set to zero before the first time) until S_OK is returned. S_FALSE is returned indicating additional information is left. Optionally, the cookie pointer passed in may be NULL, which specifies the application wants all of the words at once. However, the lexicon is not required to support this and may return the error SP_LEX_REQUIRES_COOKIE. The SpLexicon object (container lexicon) requires a cookie currently.
The following is an example of using GetWords.
SPWORDLIST spwordlist;
memset(&spwordlist, 0, sizeof(spwordlist));
dwCookie = 0;
while (SUCCEEDED(hr = pISpLexicon->GetWords(eLEXTYPE_USER | eLEXTYPE_APP, &dwGeneration, &dwCookie, &spwordlist)))
{
for (SPWORD *pword = spwordlist.pFirstWord;
pword != NULL;
pword = pword->pNextWord)
{
for (SPWORDPRONUNCIATION *pwordpron = pword->pFirstWordPronunciation;
pwordpron != NULL;
pwordpron = pwordpron->pNextWordPronunciation)
{
DoSomethingWith(pwordpron->ePartOfSpeech, pwordpron->pszPronIPA);
}
}
if (hr == S_OK)
break; // nothing more to retrieve
}
//free all the buffers
CoTaskMemFree(spwordlist.pvBuffer);
You are reading help file online using chmlib.com
|