With MFC, to paint the background of a controls or widgets, you can override OnPaint(), but there is another mechanism in that the parent object of a control provides background color for the control.
That is to make the parent respond to WM_CTLCOLOR or one of its variants, but in MFC 4.0 ( which is already pretty old ) provides more expanded functionality of that. It’s called Message Reflection. With Message Reflection, interested messages can be handled by the child control windows as well as the parent windows.
TN062: Message Reflection for Windows Controls
NOTE : Ok. Here is another example I think the MFC engineering team did wrong.
When we say “Window”, it means “Window”. However, in Win32/MFC terminology, it can mean other controls/widgets.
For example, if you want to set a text of a CEdit, you call CEditInstance->SetWindowText().
It’s not to change the “title bar text” of the window. It’s to set text of the CEdit. Why is it designed as such?
Well, there are two different classes in MFC, i.e. CWindow and CWnd. CWindow is for “Window” which we know generally. CWnd is a parent class of any visual elements or Widgets in MFC space. However, as the class name implies, we, long time windows programmers, tended to mention that as a class for window.
So, there is nomenclature problem. There are many wrong doing in design of MFC. If compared to that of .NET or Cocoa, we can see how poorly MFC was designed.
I hope MS someday fixes all the problems of MFC, but I doubt if it would happen, because they nowadays concentrate more on C#/.NET ( not even C++/.NET )
Well.. CLR is practically fast. That’s what most people, especially S/W engineers working for “business logic” think. Yeah.. they were Visual Basic or Java programmers. To their standard, they think CLR is very fast. To people like me, who have been hardcore native C/C++ programmers and someone who has a background in Computer Science, we don’t think so. Well.. more strictly speaking, we know that it’s practically fast. Probably most C++ programmers in their 20’s and 30’s nowadays are kind of new kids on the block to me, and they will not agree with me. However, in 80′ and 90’s we had agreed upon that.