ISRCentral::Register

HRESULT Register(PVOID pNotifyInterface, IID IIDNotifyInterface,

DWORD *pdwKey);

Registers an ISRNotifySink interface for the engine to use to notify the application of grammar-independent recognitions. The application must call the UnRegister member function for each Register call.

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

E_INVALIDARG
E_OUTOFMEMORY
SRERR_INVALIDINTERFACE
SRERR_VALUEOUTOFRANGE

pNotifyInterface

[in] Address of the notification interface. 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 ISRCentral::Unregister member function is called for the given key. The application must release any reference counts it holds on the notification interface after calling Register, unless it needs the notification object is to be valid after calling Unregister.

IIDNotifyInterface

[in] Identifier of the interface used for notification. Currently, the identifier must be IID_ISRNotifySinkA (for ANSI) or IID_ISRNotifySinkW (for Unicode. An application can use IID_ISRNotifySink to get ANSI or Unicode, depending on the default for the application. An engine can define additional values to support custom interfaces.

pdwKey

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

Grammar-dependent recognitions are notified through an ISRGramNotifySink interface, which is passed to a grammar object at the time the object is created. For more information, see the description of the ISRCentral::GrammarLoad member function.