Changed message loop implementation on Windows.