ITTSCentral::Register

HRESULT Register(PVOID pNotifyInterface, IID IIDNotifyInterface,
DWORD *pdwKey);

Registers an ITTSNotifySink interface for the engine to use to notify the application of buffer-independent text-to-speech events.

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

<E_INVALIDARG>
<E_OUTOFMEMORY>
<TTSERR_INVALIDINTERFACE>

pNotifyInterface

[in] Address of the notification interface through which the engine notifies the application about buffer-independent text-to-speech information. The interface identifier is specified by IIDNotifyInterface.

Because passing the address to the engine does not transfer ownership of the notification interface, the engine must call the AddRef member function of the notification interface before returning from the call to Register. The engine must also call the Release member function of the notification interface when the ITTSCentral::UnRegister member function is called for the given key. The calling application must release any reference counts it holds on the notification interface after calling Register, unless it needs the notification object to be valid after calling UnRegister.

IIDNotifyInterface

[in] Interface identifier of the interface used for notification. In the current implementation, the identifier must be IID_ITTSNotifySinkA (for ANSI) or IID_ITTSNotifySinkW (for Unicode). An engine can define additional values to support custom interfaces. An application can use the IID_ITTSNotifySink identifier to get ANSI or Unicode, depending on the default for the application.

pdwKey

[out] Address of a variable that receives a key for the notification interface. The application must supply this key with the UnRegister member function to release the interface.

An application can call Register multiple times. The member function returns a different key each time it is called.

An application can use IID_ITTSNotifySink to get ANSI or Unicode, depending on the default for the application. For more information about ANSI and Unicode versions of interfaces and structures, see the section, "Common Elements of the Speech Application Programming Interface."