VCL Control Messages (values): parameters: comments:
CM_BASE
($B000)
CM_ACTIVATE no params used when app is actived or a
(CM_BASE + 0) custom form is modally shown
CM_DEACTIVATE no params counter part to CM_ACTIVATE
(CM_BASE + 1)
CM_GOTFOCUS no params not used
(CM_BASE + 2)
CM_LOSTFOCUS no params not used
(CM_BASE + 3)
CM_CANCELMODE TCMCancelMode used to stop special behaviour of
(CM_BASE + 4) controls like TDBLookup
CM_DIALOGKEY TCMDialogKey used in the KeyPreview chain of a
(CM_BASE + 5) form to determin whether a child
control processes special keys like
TAB, arrow keys etc.
CM_DIALOGCHAR TCMDialogChar same as CM_DIALOGKEY but for
(CM_BASE + 6) characters
CM_FOCUSCHANGED TCMFocusChanged used in forms when the active
(CM_BASE + 7) control changes
CM_PARENTFONTCHANGED if wParam = 1 then lParam
(CM_BASE + 8) contains a TFont else just
use the font of the parent
used in all controls
CM_PARENTCOLORCHANGED if wParam = 1 then
(CM_BASE + 9) lParam contains a color
else just use the color of
the parent used in all
controls
CM_HITTEST TCMHitTest used only at design time (and only
(CM_BASE + 10) in ControlAtPos) to determine the
control at the current mouse
Message.Result = 0 if control
considers itself as not hit else 1
CM_VISIBLECHANGED wParam = 1 if visible, used when a control's visibility is
(CM_BASE + 11) lParam contains changed by its Visible property
CM_ENABLEDCHANGED no params used when a control is enabled or
(CM_BASE + 12) disabled by its Enabled property
CM_COLORCHANGED no params used when a control's color is
(CM_BASE + 13) changed by its Color property
CM_FONTCHANGED no params used in the TFont.OnChange
(CM_BASE + 14) event of a control's font
CM_CURSORCHANGED no params used when a control's cursor is
(CM_BASE + 15) changed by its Cursor property
CM_CTL3DCHANGED no params used when control's Ctrl3D
(CM_BASE + 16) property is changed
CM_PARENTCTL3DCHANGED no params used with ActiveX control
(CM_BASE + 17) (OnAmbientPropertyChange), in
response to a
CM_CTRL3DCHANGED message
and used when reading a
TWinControl from a stream
CM_TEXTCHANGED no params used when a control's text is
(CM_BASE + 18) changed
CM_MOUSEENTER wParam = 0,
(CM_BASE + 19) lParam = sometimes
a reference of the control
having the mouse pointer
over it sent by TApplication
and used internally by
TSpeedButton
CM_MOUSELEAVE as in counterpart to
(CM_BASE + 20) CM_MOUSEENTER CM_MOUSEENTER
CM_MENUCHANGED no params internal message for TMenu
(CM_BASE + 21) (when merging or an item has
changed)
CM_APPKEYDOWN wParam = KeyCode, sent only when determining
(CM_BASE + 22) lParam = KeyData (like in whether a key is a menu key
WM_KEYDOWN)
CM_APPSYSCOMMAND wParam = 0, sent in response to a
(CM_BASE + 23) lParam = @Message WM_SYSCOMMAND message (received by a TWinControl)
passing the entire Message record
in lParam (used in hint windows
and by the application to focus
itself)
CM_BUTTONPRESSED wParam = group index, used internally by TSpeedButton
(CM_BASE + 24) lParam = button reference to implement button groups
CM_SHOWINGCHANGED no params sent by TWinControl on various
(CM_BASE + 25) events (window creation, loading
from stream, new parent
assignment), used in TCoolBand
on destroy and by TMemoStrings
on UpdateState change
CM_ENTER TCMEnter sent by TForm when the focus
(CM_BASE + 26) changes to another child control
and by TApplication when it gets
the focus
CM_EXIT TCMExit sent by TForm when the focus
(CM_BASE + 27) changes to another child
CM_DESIGNHITTEST TCMDesignHittest special message never sent from
(CM_BASE + 28) within the VCL (but from a
designer DLL), used only at
design time to determine whether
a control wants mouse and key
input. Message.Result = 1 if the
control behaves like at runtime
else 0
CM_ICONCHANGED no params sent by TApplication from its
(CM_BASE + 29) FIcon.OnChange event
CM_WANTSPECIALKEY TCMWantSpecialKey sent by TControl in response to
(CM_BASE + 30) CN_KEYDOWN and CN_KEYUP
CM_INVOKEHELP wParam = command, sent by TApplication to the main
(CM_BASE + 31) lParam = Data form on help invoking (nowhere
used)
CM_WINDOWHOOK wParam = 0 if hooking sent by TApplication when a form
(CM_BASE + 32) = 1 if unhooking hooks or unhooks the main
lParam = @@Hook window proc
CM_RELEASE no params sent by TForm on release of itself
(CM_BASE + 33) and by TFindDialog when to notify
its redirector
CM_SHOWHINTCHANGED no params used when a control's ShowHint
(CM_BASE + 34) property is changed
CM_PARENTSHOWHINTCHANGED no params used at various places (in
(CM_BASE + 35) response to a
CM_SHOWHINTCHANGED
message, when reading a controls
data from a stream etc.)
CM_SYSCOLORCHANGE no params sent in response to a
(CM_BASE + 36) WM_SYSCOLORCHANGE
message (by TWinControl)
CM_WININICHANGE TWMWinIniChange sent by TWinControl in response
(CM_BASE + 37) to WM_WININICHANGE
CM_FONTCHANGE no params sent by TWinControl in response
(CM_BASE + 38) to WM_FONTCHANGE
CM_TIMECHANGE no params sent by TWinControl in response
(CM_BASE + 39) to WM_TIMECHANGE
CM_TABSTOPCHANGED no params used when a control's TabStop
(CM_BASE + 40) property is changed
CM_UIACTIVATE no params sent by TCustomForm when the
(CM_BASE + 41) active control changes and is used
primarily for OLE controls
CM_UIDEACTIVATE no params counterpart to CM_UIACTIVATE
(CM_BASE + 42)
CM_DOCWINDOWACTIVATE wParam = active, sent by TCustomForm on
(CM_BASE + 43) lParam = 0 activation/deactivation to the
current OLE control if there's one
CM_CONTROLLISTCHANGE wParam = Control, sent by TWinControl on inserting/
(CM_BASE + 44) lParam = 1 if inserting removing a child control
else 0
CM_GETDATALINK no params sent by TDBCtrlGrid to retrieve an
(CM_BASE + 45) eventual data link of a control
(Message.Result returns the link if
applicable)
CM_CHILDKEY TCMChildKey sent by TWinControl in response
(CM_BASE + 46) to CN_KEYDOWN and
CN_SYSKEYDOWN and by
TActiveXControl when translating accelerator keys
CM_DRAG TCMDrag sent by internal drag routines
(CM_BASE + 47) (Controls.pas) and used by
TWinControl to trigger the
various drag and dock events
CM_HINTSHOW wParam = 0, sent by TApplication on hint
(CM_BASE + 48) lParam = @THintInfo activation and on mouse
messages
CM_DIALOGHANDLE wParam = 0, sent by TApplication when
(CM_BASE + 49) lParam = Handle when DialogHandle is read or written to
setting and the applications handle has
wParam = 1, not yet been created, when
lParam = 0 when reading reading the dialog handle then
Message.Result contains the new
handle
CM_ISTOOLCONTROL no params sent by TOLEForm to determine if
(CM_BASE + 50) its child controls are tool controls,
used only by TCustomPanel
CM_RECREATEWND no params sent by
(CM_BASE + 51) TWinControl.RecreateWnd and
TFieldDataLink.UpdateRightToLeft
CM_INVALIDATE wParam = 1 if repaint is sent by TWinControl.Invalidate
(CM_BASE + 52) required else 0, to notify itself and its parent
lParam = 0 of the invalidation request
CM_SYSFONTCHANGED no params sent by TScreen if its IconFont is
(CM_BASE + 53) changed and by TControl when
reading properties from stream or
changing DesktopFont
CM_CONTROLCHANGE TCMControlChange sent by TWinControl when
(CM_BASE + 54) inserting or removing a child
control
CM_CHANGED wParam = 0, sent by TControl.Changed
(CM_BASE + 55) lParam = Self
CM_DOCKCLIENT TCMDockClient sent by TWinControl.DockDrop to
(CM_BASE + 56) determine whether docking is
allowed or not
CM_UNDOCKCLIENT TCMUndockClient sent by TControl on Destroy, by
(CM_BASE + 57) TWinControl.DoUnDock and
TCustomDockForm on removing a
child control
CM_FLOAT TCMFloat sent by internal drag/dock routines
(CM_BASE + 58) to make a control floating
CM_BORDERCHANGED no params sent by TWinControl when
(CM_BASE + 59) BorderWidth or BevelWidth styles
are changed
CM_BIDIMODECHANGED no params sent by TControl.SetBiDiMode
(CM_BASE + 60)
CM_PARENTBIDIMODECHANGED no params sent at various places (in
(CM_BASE + 61) response to
CM_BIDIMODECHANGED, when
reading a control from a stream,
when reading a custom from from
a stream, when BiDiMode of
TApplication changes and when
TCustomRichEdit is created)
CM_ALLCHILDRENFLIPPED no params sent by
(CM_BASE + 62) TWinControl.DoFlipChildren
CM_ACTIONUPDATE wParam = 0, sent by TContainedAction.Update
(CM_BASE + 63) lParam = Action
CM_ACTIONEXECUTE wParam = 0, sent by TContainedAction.Execute
(CM_BASE + 64) lParam = Action
CM_HINTSHOWPAUSE wParam = 1 if hint was sent by TApplication on mouse
(CM_BASE + 65) active messages,when there's a new
lParam = time interval control under the mouse and has
when to show new hint ShowHint set to True
CM_DOCKNOTIFICATION TCMDocNotification sent by
(CM_BASE + 66) TControl.SendDockNotification
which is executed in response to
CM_VISIBLECHANGED and
WM_SETTEXT
CM_MOUSEWHEEL TCMMouseWheel general mousewheel message
(CM_BASE + 67) generated either by the registered
mouse wheel message or
WM_MOUSEWHEEL (not
Win95) and sent by TWInControl
VCL Control Notifications
VCL Control Notifications are just reflections of the corresponding WM_xxx messages. They are sent by a window to their parent window (not VCL but Windows). This makes in Delphi no sense as the parent knows basically nothing about its child windows and can therefore not handle them. Each of these messages contains in its lParam the handle of the child window which has sent the message. The VCL does nothing else then to add CN_BASE to the message value and sends the message then to the window which created it originally. This way windows can handle their special messages themselves.
Control Notification Value
CN_BASE $BC00
CN_CHAR CN_BASE + WM_CHAR
CN_CHARTOITEM CN_BASE + WM_CHARTOITEM
CN_COMMAND CN_BASE + WM_COMMAND
CN_COMPAREITEM CN_BASE + WM_COMPAREITEM
CN_CTLCOLORBTN CN_BASE + WM_CTLCOLORBTN
CN_CTLCOLORDLG CN_BASE + WM_CTLCOLORDLG
CN_CTLCOLOREDIT CN_BASE + WM_CTLCOLOREDIT
CN_CTLCOLORLISTBOX CN_BASE + WM_CTLCOLORLISTBOX
CN_CTLCOLORMSGBOX CN_BASE + WM_CTLCOLORMSGBOX
CN_CTLCOLORSCROLLBAR CN_BASE + WM_CTLCOLORSCROLLBAR
CN_CTLCOLORSTATIC CN_BASE + WM_CTLCOLORSTATIC
CN_DELETEITEM CN_BASE + WM_DELETEITEM
CN_DRAWITEM CN_BASE + WM_DRAWITEM
CN_KEYDOWN CN_BASE + WM_KEYDOWN
CN_KEYUP CN_BASE + WM_KEYUP
CN_HSCROLL CN_BASE + WM_HSCROLL
CN_MEASUREITEM CN_BASE + WM_MEASUREITEM
CN_NOTIFY CN_BASE + WM_NOTIFY
CN_PARENTNOTIFY CN_BASE + WM_PARENTNOTIFY
CN_SYSKEYDOWN CN_BASE + WM_SYSKEYDOWN
CN_SYSCHAR CN_BASE + WM_SYSCHAR
CN_VKEYTOITEM CN_BASE + WM_VKEYTOITEM
CN_VSCROLL CN_BASE + WM_VSCROLL