WM_NCLBUTTONDOWN issue

2004-08-31
2004-09-01
  • moswald0000
    moswald0000
    2004-08-31

    When I handle the WM_NCLBUTTONDOWN event, pressing the 'close' button on the title bar causes a crash deep within win32gui.  If you need some example source code, I'll post a simplified version that exhibits the same behavior.

    --Incidentally, I think win32gui is a great library.  I'm looking forward to my next copy of CUJ!

     
    • John Torjo
      John Torjo
      2004-08-31

      It may be because you've called ::DefWindowProc yourself. But please, send me some code (to john@torjo.com) and try to see what's causing it.

      Best,
      John

       
    • John Torjo
      John Torjo
      2004-08-31

      It may be because you've called ::DefWindowProc yourself. But please, send me some code (to john@torjo.com) and I'll try to see what's causing it.

      Best,
      John

       
      • moswald0000
        moswald0000
        2004-08-31

        That could very well be the case.  I'll make the change that you recommended in the other thread, and see if that fixes the problem.  I'll post back here either way to let you know what the final result is.

         
        • moswald0000
          moswald0000
          2004-09-01

          So the final result is that all I needed to do was set answer = event_not_handled.  (But I didn't need to return event_handled_early.)  Once I did that, the whole thing worked like a charm.  Thanks for your help!

           
          • John Torjo
            John Torjo
            2004-09-01

            Indeed ;)
            The 'return event_handled_early;' is just to use instead of simply 'return;', in case you want to exit your function early.

            This is because you need to return something that is convertible to a 'handle_event'. Copying the event<...>().HANDLED_BY(...) you have at the end of your function would be quite cumbersome and error prone.

            Best,
            John