// 4(a)
struct log_handler
: subclass::auto_event_handler<log_handler, window_base> {
handle_event any_event(msg_param msg, hwnd_param h) {
// .. do logging
return event<0>().HANDLED_BY(&me::any_event);
}
};
// 4(b)
namespace { bool do_log = true; }
struct log_handler
: subclass::auto_event_handler<log_handler, window_base> {
// ... same as before
static bool matches_wnd(window_base*) { return do_log; }
};
void enable_logging(bool b) { do_log = b; }