VCL has some non-API messages for internal use, why do you do this? From the WM_COMMAND & wm_notify message, we say that the WM_COMMAND message is not sent directly to the form that actually generated the message, but rather to its parent form. However, it is almost impossible for a parent form to handle these messages that do not know how to handle them in the usual way, so the parent form adds the message to the cn_base in the actual subform, which is then processed by the actual subform (the sentence is clear enough).
For example, the TBITBTN element, in order to draw an image on the button surface, processing the Cn_drawitem message, this message handler function is written like this:
FCanvas.Handle := DrawItemStruct.hDC;
R := ClientRect;
… //省略一部分
if IsDown then
OffsetRect(R, 1, 1);
TButtonGlyph(FGlyph).Draw(FCanvas, R, Point(0,0), Caption, FLayout, FMargin,
FSpacing, State, False, DrawTextBiDiModeFlags(0));
if IsFocused and IsDefault then
begin
R := ClientRect;
InflateRect(R, -4, -4);
FCanvas.Pen.Color := clWindowFrame;
FCanvas.Brush.Color := clBtnFace;
DrawFocusRect(FCanvas.Handle, R);
end;
FCanvas.Handle := 0;
It can be seen that this is similar to the usual method of handling paint, which is actually plotted on HDC. If you have studied the SDK, we can actually process the WM_NOTIFY message to handle the messages generated by the control, but the VCL encapsulates it for us.
Reference: http://www.rrzxw.net/biancheng/VC/2012/0304/7615.html
------------------------------------------------------------------------------
But there is also a lack of a cn_ message detailed description of the example and run the process, there is time to fill in
The source of the CN message-The parent window does not know how to handle it, so add the message cn_base in the distribution to the actual subform