Listing 6

// mmove.h
typedef void (*func)(window_base*);
void subscribe(func f);

// mmove.cpp (note - not thread safe)
namespace {
  typedef std::vector<func> array; 
  static array s_subscribs;
}
struct mmove_handler 
    : subclass::manual_event_handler<mmove_handler,window_base> {
  handle_event on_move() {
    array::iterator b =s_subscribs.begin(), e = s_subscribs.end();
    for( ; b != e; ++b) (*b)( window() );
    return event<WM_MOUSEMOVE>().HANDLED_BY(&me::on_move);
  }
};
void subcribe(func f) { s_subscribs.push_back(f); }
// code
void print_move(window_base * w) {
    std::cout << "movement on " << w->text() << std::endl;
}
subscribe(print_move);