Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Collapse the table of content
Expand the table of content

ISpNotifyTranslator::InitCallback (SAPI 5.4)

Speech API 5.4
Microsoft Speech API 5.4


ISpNotifyTranslator::InitCallback sets up this instance to send notifications using a standard C-style callback function.

HRESULT InitCallback(
   SPNOTIFYCALLBACK   *pfnCallback,
   WPARAM              wParam,
   LPARAM              lParam


[in] The notification callback function to be used.
[in] Constant WPARAM value that will be passed to the pfnCallback function when it is called.
[in] Constant LPARAM value that will be passed to the pfnCallback function when it is called.

Return values

S_OKFunction completed successfully.
SPERR_ALREADY_INITIALIZEDSpTranslator object is already initialized.
E_INVALIDARGpfnCallback is invalid or bad.
FAILED(hr)Appropriate error message.


The translator implementation uses a hidden window to call back the client on the same thread that was used to initialize the event source. Notify callbacks are the result of processing a window message. When this 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);

© 2015 Microsoft