How to message handling in Windows?