Processing Voice-Text Notifications

The voice-text object calls an application's IVTxtNotifySink interface to inform the application of voice-text events so that the application can respond to them. To receive notifications, the application must create a COM object that supports IVTxtNotifySink and must pass the address of the interface to the voice-text object when calling the IVoiceText::Register member function.

The IVTxtNotifySink interface consists of a set of member functions that correspond to voice-text events. When an event occurs on the voice-text site that the application is using, the voice-text object calls the member function that corresponds to the event. The application developer determines how the member functions process the event notifications.

The following example shows how to define an object class that implements the IVTxtNotifySink interface.

class CIVTxtNotifySink : public IVTxtNotifySink {

private:

HWND m_hwnd;

public:

CIVTxtNotifySink(void);

~CIVTxtNotifySink(void);

// IUnknown members

STDMETHODIMP QueryInterface (REFIID, LPVOID FAR *);

STDMETHODIMP_(ULONG) AddRef(void);

STDMETHODIMP_(ULONG) Release(void);

// IVTxtNotifySink members

STDMETHODIMP AttribChanged (DWORD;

STDMETHODIMP Speak (PSTR, PSTR, DWORD);

STDMETHODIMP SpeakingDone (void);

STDMETHODIMP SpeakingStarted (void);

STDMETHODIMP Visual (WCHAR, CHAR, DWORD, PTTSMOUTH);

};

typedef CIVTxtNotifySink * PCIVTxtNotifySink;