How do I stop events from bubbling up?

I have this window procedure running:

static LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

   switch (msg) {

      case WM_KEYDOWN:
      case WM_SYSKEYDOWN:
      case WM_KEYUP:
      case WM_SYSKEYUP:
         processKeyMessage( msg, wParam, lParam );
         break;
   }
   return DefWindowProc(hWnd, msg, wParam, lParam);
}

How do I stop the keyboard messages from bubbling up to the parent application once they're processed?  I tried return true; but they still get sent.
LVL 5
GENTPAsked:
Who is Participating?
 
jkrCommented:
That should be

static LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

   switch (msg) {

      case WM_KEYDOWN:
      case WM_SYSKEYDOWN:
      case WM_KEYUP:
      case WM_SYSKEYUP:
         processKeyMessage( msg, wParam, lParam );
         return 0; // <----------------!
         break;
   }
   return DefWindowProc(hWnd, msg, wParam, lParam);
}

From the docs on these keyboard messages:

"An application should return zero if it processes this message"
0
 
GENTPAuthor Commented:
d'oh.  Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.