event handling question

  • Anonymous

    Anonymous - 2004-08-31

    I may decide I don't want to continue handling an event after entering my event handler.  Is there any way to continue with the default, besides calling ::DefWindowProc?


    handle_event my_handler(w_param<> w)
       // do something based on w
       if( i_dont_want_to_handle_this )
          ::DefWindowProc(WM_MESSAGE, ...);

       return event<WM_MESSAGE>().HANDLED_BY( &me::my_handler )

    • John Torjo

      John Torjo - 2004-08-31

      It's possible and quite simple:
      (unfortunately did not have time to explain this in CUJ, but it's implemented)

      The idea is to have an extra parameter, like this:

      handle_event on_some_msg(whatever, answer a) {
         if ( i_decide_not_to_handle) {
           a = event_not_handled;
           return event_handled_early;
         ... normal processing
         return event<WM_someev>().HANDLED_BY(...);

      P.S. Don't call DefWindowProc directly. It's called only if needed. I'll explain it later in CUJ ;) Also, docs explaining this should be available in 2-3 weeks.



Log in to post a comment.