Compile with MSVC

Move variable declarations to beginning of block. Use alloca instead of
dynamically sized arrays.
Win32 events