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!
It may be because you've called ::DefWindowProc yourself. But please, send me some code (to firstname.lastname@example.org) and try to see what's causing it.
It may be because you've called ::DefWindowProc yourself. But please, send me some code (to email@example.com) and I'll try to see what's causing it.
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.
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!
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.