MessageFilter

Introduction

If you want PreTranslateMessage messages, you need MessageFilter class.

Examples

PreTranslateMessage

This is a model dialog application. In WTL, a model dialog can't recieve PreTranslateMessage messages. But in winx you can. This application will tell you how to do this.

This application is just a demo how to implement accelerator by PreTranslateMessage. I don't recommend you do so of course (use WINX_ACCELFRAME please).

CHelloDlg, the model dialog class, is derived from winx::MessageFilter<CHelloDlg, 0>, NOT from winx::MessageFilter<CHelloDlg>. If we change it to winx::MessageFilter<CHelloDlg>, It will can't receive PreTranslateMessage messages. In Dive into MessageFilter, I will explain why. Another important thing is, don't call Windows API: IsDialogMessage if your code is in PreTranslateMessage procedure of a model dialog. The reason is also explained in Dive into MessageFilter.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License