[Programming Visual C++]Chapter SixSetting the Color for the Dialog Background and for Controls


For Win32 Programmers

Actually, Win32 no longer has a WM_CTLCOLOR message. It was replaced by control-specific messages such as WM_CTLCOLORBTN, WM_CTLCOLORDLG, and so on. MFC and ClassWizard process these messages invisibly, so your programs look as though they're mapping the old 16-bit WM_CTLCOLOR messages. This trick makes debugging more complex, but it makes portable code easier to write. Another option would be to use the ON_MESSAGE macro to map the real Win32 messages.

If your dialog class (or other MFC window class) doesn't map the WM_CTLCOLOR message, the framework reflects the message back to the control. When you study window subclassing in Chapter 16, you'll learn how to write your own control window classes that can process these reflected messages.

原文地址:https://www.cnblogs.com/huqingyu/p/206535.html