Restructured WIN32 window event loop