ISpNotifySource::SetNotifyCallbackFunction
This method sets up an ISpNotifySource object to send notifications using a standard C-style callback function. It is the responsibility of the client code to control the lifetime of a notification. To remove an installed notify callback, the client should call ISpNotifySource::SetNotifySink. The final release of an object that supports ISpEventSource will automatically remove an installed notify callback.
HRESULT SetNotifyCallbackFunction(
SPNOTIFYCALLBACK* pfnCallback,
WPARAM wParam,
LPARAM lParam
);
Parameters
- pfnCallback
[in] Notification callback function to use. - wParam
[in] Constant WPARAM value to pass to the callback function when it is called. - lParam
[in] Constant LPARAM value to pass to the callback function when it is called.
Return Values
The following table shows the possible return values.
Value | Description |
---|---|
S_OK | Function completed successfully. |
E_INVALIDARG | Callback function is invalid. |
FAILED(hr) | Appropriate error message. |
Remarks
The SAPI implementation uses a hidden window to call back the client on the same thread that was used to initialize the event source. Notification callbacks are the result of processing a window message. When this means notification mechanism is used:
- The SPNOTIFYCALLBACK method will always be called on the thread that initialized the event source or notify translator object.
- The thread must have a window message pump. The SPNOTIFYCALLBACK function is declared as follows:
typedef void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam);
Requirements
OS Versions: Windows CE .NET 4.1 and later.
Header: Sapi.h, Sapi.idl.
Link Library: Sapilib.lib.
See Also
ISpNotifySource | SAPI Interfaces
Last updated on Saturday, April 10, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.