다음을 통해 공유


SPWORDPRONUNCIATIONLIST (Windows CE 5.0)

Send Feedback

This structure contains information about possible variations in pronunciation for a given word. It is the start of a linked list of SPWORDPRONUNCIATION structures, and contains the size and actual buffer of all subsequent pronunciations. The structure is used with ISpLexicon::GetPronunciations.

typedef struct SPWORDPRONUNCIATIONLIST{  ULONGulSize;  BYTE* pvBuffer;  SPWORDPRONUNCIATION* pFirstWordPronunciation;} SPWORDPRONUNCIATIONLIST;

Members

  • ulSize
    Size, in bytes, of the pronunciation buffer (pvBuffer).
  • pvBuffer
    Pointer to the pronunciation buffer.
  • pFirstWordPronunciation
    Pointer to an SPWORDPRONUNCIATION structure representing the first pronunciation in the linked list contained in the buffer specified by pvBuffer.

Remarks

The client should call the Platform SDK memory management function ZeroMemory before using this structure to initialize it, and call CoTaskMemFree to free the buffer allocated during the calls The buffer should not be freed between the calls. ISpLexicon::GetPronunciations reuses the buffer for efficiency and will reallocate it when necessary. For more information about ZeroMemory, see the MSDN Library.

Example

The following example is a code fragment demonstrating the use and creation of an SPWORDPRONUNCIATIONLIST structure.

SPWORDPRONUNCIATIONLIST spwordpronlist;
memset(spwordpronlist, 0, sizeof(spwordpronlist));
pISpLexicon->GetPronunciations(L"resume", 0, 0, &spwordpronlist);
for (SPWORDPRONUNCIATION *pwordpron = spwordpronlist.pFirstWordPronunciation;
wordpron != NULL;
wordpron = pwordpron->pNextWordPronunciation)
{
    DoSomethingWith(pwordpron->ePartOfSpeech, pwordpron->szPronunciation);
}
pISpLexicon->GetPronunciations(L"record", 0, 0, &spwordpronlist);
// repeat the previous for loop to process the pronunciations
CoTaskMemFree(spwordpronlist.pvBuffer);

The following helper class will ensure the correct use of SPWORDPRONUNCIATIONLIST.

class CSpPronList : public SPWORDPRONUNCIATIONLIST
{
    public:
    CSpPronList()
    {
        ZeroMemory(static_cast<SPWORDPRONUNCIATIONLIST*>(this), sizeof(SPWORDPRONUNCIATIONLIST));
    }
    ~CSpPronList()
    {
        CoTaskMemFree(pvBuffer);
    }
};

Using the helper class, the previous example becomes:

CSpPronList spwordpronlist;
pISpLexicon->GetPronunciations(L"resume", 0, 0, &spwordpronlist);
for (SPWORDPRONUNCIATION *pwordpron = spwordpronlist.pFirstWordPronunciation;
wordpron != NULL;
wordpron = pwordpron->pNextWordPronunciation)
{
    DoSomethingWith(pwordpron->ePartOfSpeech, pwordpron->szPronunciation);
}
pISpLexicon->GetPronunciations(L"record", 0, 0, &spwordpronlist);
// repeat the previous for loop to process the pronunciations

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapi.h, Sapi.idl.

See Also

SAPI Structures

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.