wwindow message handling with templates