Why doesn't SetNotifyWindowMessage() call my WndProc()?

Posted by manuel on Stack Overflow See other posts from Stack Overflow or by manuel
Published on 2010-04-13T04:18:46Z Indexed on 2010/04/13 4:22 UTC
Read the original article Hit count: 302

I'm using WinForms, and I'm trying to get SetNotifyWindowMessage() to call the WndProc, but it does not do so.

The function call:

HRESULT initSAPI(HWND hWnd)
{
  ...
  if(FAILED( g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 )))
    MessageBoxW(hWnd, L"Error sending window message", L"SAPI Initialization Error", 0);
  ...
}

The WndProc:

LRESULT WndProc (HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
{
   case WM_RECOEVENT:
      ProcessRecoEvent(hWnd);
      break;
   default:
      return DefWindowProc(hWnd, message, wParam, lParam);
}

Note: initSAPI() is called on a mouse click event.

© Stack Overflow or respective owner

Related posts about speech-recognition

Related posts about wndproc