static UINT uiID_Error_Message = 0;
static UNIT uiID_Buffer_Message = 0;
static UNIT uiID_Index_Message = 0;
// Window Procedure
VOID MyWndProc(LONG lParam1, LONG lParam2, DWORD dwCallbackParameter, UINT uiMsg)
{
if (uiMsg == uiID_Error_Message)
{
// lParam1 contains error code
// lParam2 contains value of MMRESULT
}
else if (uiMsg == uiID_Index_Message)
{
// lParam2 contains index mark
}
else if (uiMsg == uiID_Buffer_Message)
{
// lParam2 contains Pointer to buffer
}
}
VOID main()
{
LPTTS_HANDLE_TAG phTTS;
TextToSpeechStartupEx(&phTTS, WAVE_MAPPER, REPORT_OPEN_ERROR, MyWndProc, 0);
// Registering messages to report DECtalk asynchronous events
uiID_Error_Message = RegisterWindowMessage("DECtalkErrorMessage");
// Callback message is registered indicating index marks
uiID_Index_Message = RegisterWindowMessage("DECtalkIndexMessage");
// Callback message is registered indicating DECtalk has filled up an audio buffer
uiID_Buffer_Message = RegisterWindowMessage("DECtalkBufferMessage");
}