Share via


ISpNotifySource::SetNotifyCallbackFunction (Windows Embedded CE 6.0)

1/6/2010

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.

Syntax

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 Value

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:

  1. The SPNOTIFYCALLBACK method will always be called on the thread that initialized the event source or notify translator object.
  2. The thread must have a window message pump. The SPNOTIFYCALLBACK function is declared as follows:
typedef void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam);

Requirements

Header sapi.h, sapi.idl
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

ISpNotifySource
SAPI Interfaces