c++ event driver programming