added file logging and changed RegisterWindowMessage