I can't find documentation for it, even on MSDN...
Message reflection lets you handle messages for a control, such as WM_CTLCOLOR, WM_COMMAND, and WM_NOTIFY, within the control itself. This makes the control more self-contained and portable. The mechanism works with Windows common controls as well as with ActiveX controls (formerly called OLE controls).
The operating system communicates with your application window by passing messages to it. A message is simply a numeric code that designates a particular event. For example, if the user presses the left mouse button, the window receives a message that has the following message code.
The message loop is an obligatory section of code in every program that uses a graphical user interface under Microsoft Windows. Windows programs that have a GUI are event-driven. Windows maintains an individual message queue for each thread that has created a window. Usually only the first thread creates windows.
Windows MessagesThe system passes input to a window procedure in the form of a message. Messages are generated by both the system and applications. The system generates a message at each input event—for example, when the user types, moves the mouse, or clicks a control such as a scroll bar.
It's not Win32; it's MFC. Ordinarily, a Win32 control raises events by sending a message to its parent window. However, if you've got your own class derived from one of MFC's wrappers (e.g. you've wrapped CTreeCtrl with CMyFunkyTreeCtrl), you might want to handle these events in the derived class.
MFC uses these reflection messages to bounce the event back to the class itself, where your derived class can see them.
Look at TN062: Message Reflection for Windows Controls (MFC) for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With