You are on page 1of 11

VCL Component Messages ( Zusammengestellt von Mike Lischke [http://www.lischke-online.de], bearbeitet von Simon Reinhardt [http://www.pics-software.

de] ) {Compiled by Mike Lischke [http://www.lischke-online.de], edited by Simon Reinhardt [http://www.pics-software.de]) Component Messages (CM_) werden ausschlielich von der VCL generiert und sind nicht reflektierte Windows Messages (WM_), wie man annehmen knnte. Component Notifications (CN_) sind dagegen reflektierte Windows Messages. Der Sinn ist, dass Windows oft Nachrichten an das Elternfenster eines Controls anstelle des Controls selbst versendet. Die VCL konvertiert diese einfach zu Component Notifications und sendet sie dann wieder an das Control fr das die Message eigentlich bestimmt war. <TRANSLATION> Component Messages (CM_) are generated only by the VCL and are not reflected Windows Messages (WM_), as one may assume. In spite of that Component Notifications (CN_) are reflected Windows Messages. The idea behind it is, that Windows often sends messages to a parent window of a control instead of the control itself. The VCL simply converts (reflects) these messages to Component Notifications and then sends it to the control, for which the message originally was meant. </TRANSLATION> VCL Control Messages (values): parameters: CM_BASE ($B000) CM_ACTIVATE app is actived or a (CM_BASE + 0) modally shown CM_DEACTIVATE CM_ACTIVATE (CM_BASE + 1) CM_GOTFOCUS (CM_BASE + 2) CM_LOSTFOCUS (CM_BASE + 3) CM_CANCELMODE behaviour of (CM_BASE + 4) no params used when custom form is no params counter part to comments:

no params no params TCMCancelMode

not used not used used to stop special controls like

TDBLookup CM_DIALOGKEY KeyPreview chain of a (CM_BASE + 5) whether a child special keys like CM_DIALOGCHAR CM_DIALOGKEY but for (CM_BASE + 6) CM_FOCUSCHANGED when the active (CM_BASE + 7) CM_PARENTFONTCHANGED (CM_BASE + 8) TCMDialogChar TCMDialogKey used in the form to determin control processes TAB, arrow keys etc. same as characters TCMFocusChanged used in forms control changes if wParam = 1 then lParam contains a TFont else just use the font of the parent used in all controls if wParam = 1 then lParam contains a color else just use the color of the parent used in all controls TCMHitTest used only at design in ControlAtPos) to control at the current Message.Result = 0 considers itself as wParam = 1 if visible, lParam contains used when a changed by its

CM_PARENTCOLORCHANGED (CM_BASE + 9)

CM_HITTEST time (and only (CM_BASE + 10) determine the mouse if control not hit else 1 CM_VISIBLECHANGED control's visibility is (CM_BASE + 11) Visible property

CM_ENABLEDCHANGED is enabled or (CM_BASE + 12) Enabled property CM_COLORCHANGED control's color is (CM_BASE + 13) property CM_FONTCHANGED TFont.OnChange (CM_BASE + 14) font CM_CURSORCHANGED control's cursor is (CM_BASE + 15) Cursor property CM_CTL3DCHANGED control's Ctrl3D (CM_BASE + 16)

no params

used when a control disabled by its

no params

used when a changed by its Color

no params

used in the event of a control's

no params

used when a changed by its

no params

used when property is changed used with ActiveX

CM_PARENTCTL3DCHANGED no params control (CM_BASE + 17) (OnAmbientPropertyChange), in CM_CTRL3DCHANGED message reading a stream CM_TEXTCHANGED control's text is (CM_BASE + 18) CM_MOUSEENTER (CM_BASE + 19) no params

response to a and used when TWinControl from a used when a changed

wParam = 0, lParam = sometimes a reference of the control having the mouse pointer over it sent by TApplication and used internally by TSpeedButton as in CM_MOUSEENTER no params counterpart to CM_MOUSEENTER internal (when merging or an

CM_MOUSELEAVE (CM_BASE + 20) CM_MENUCHANGED message for TMenu (CM_BASE + 21) item has

changed) CM_APPKEYDOWN determining (CM_BASE + 22) menu key wParam = KeyCode, lParam = KeyData (like in WM_KEYDOWN) sent in response to a WM_SYSCOMMAND passing the entire in lParam (used in and by the itself) CM_BUTTONPRESSED internally by TSpeedButton (CM_BASE + 24) groups CM_SHOWINGCHANGED on various (CM_BASE + 25) creation, loading parent TCoolBand TMemoStrings change wParam = group index, lParam = button reference no params used to implement button sent by TWinControl events (window from stream, new assignment), used in on destroy and by on UpdateState sent only when whether a key is a

CM_APPSYSCOMMAND wParam = 0, (CM_BASE + 23) lParam = @Message message (received by a TWinControl) Message record hint windows application to focus

CM_ENTER the focus (CM_BASE + 26) child control when it gets CM_EXIT the focus (CM_BASE + 27) child CM_DESIGNHITTEST message never sent from (CM_BASE + 28) from a only at determine whether mouse and key Message.Result = 1 if the at runtime CM_ICONCHANGED from its (CM_BASE + 29) event CM_WANTSPECIALKEY response to (CM_BASE + 30) CN_KEYUP CM_INVOKEHELP TApplication to the main (CM_BASE + 31) invoking (nowhere CM_WINDOWHOOK TApplication when a form (CM_BASE + 32) unhooks the main CM_RELEASE release of itself (CM_BASE + 33) when to notify

TCMEnter

sent by TForm when changes to another and by TApplication the focus

TCMExit

sent by TForm when changes to another

TCMDesignHittest

special within the VCL (but designer DLL), used design time to a control wants input. control behaves like else 0

no params

sent by TApplication FIcon.OnChange

TCMWantSpecialKey

sent by TControl in CN_KEYDOWN and

wParam = command, lParam = Data used) wParam = 0 if hooking = 1 if unhooking lParam = @@Hook no params

sent by form on help

sent by hooks or window proc sent by TForm on and by TFindDialog

its redirector CM_SHOWHINTCHANGED control's ShowHint (CM_BASE + 34) no params used when a property is changed no params used at response to a message, when data from a stream no params sent in response to a message (by TWMWinIniChange to no params sent by TWinControl to WM_FONTCHANGE no params sent by TWinControl to WM_TIMECHANGE no params used when a property is changed sent by

CM_PARENTSHOWHINTCHANGED various places (in (CM_BASE + 35) CM_SHOWHINTCHANGED reading a controls etc.) CM_SYSCOLORCHANGE (CM_BASE + 36) WM_SYSCOLORCHANGE TWinControl) CM_WININICHANGE TWinControl in response (CM_BASE + 37) WM_WININICHANGE CM_FONTCHANGE in response (CM_BASE + 38) CM_TIMECHANGE in response (CM_BASE + 39) CM_TABSTOPCHANGED control's TabStop (CM_BASE + 40)

CM_UIACTIVATE TCustomForm when the (CM_BASE + 41) changes and is used controls CM_UIDEACTIVATE CM_UIACTIVATE (CM_BASE + 42)

no params

sent by active control primarily for OLE

no params

counterpart to

CM_DOCWINDOWACTIVATE wParam = active, TCustomForm on (CM_BASE + 43) lParam = 0 activation/deactivation to the there's one CM_CONTROLLISTCHANGE TWinControl on inserting/ (CM_BASE + 44) child control CM_GETDATALINK to retrieve an (CM_BASE + 45) a control returns the link if CM_CHILDKEY TWinControl in response (CM_BASE + 46) and by when translating accelerator keys CM_DRAG routines (CM_BASE + 47) used by trigger the various drag and dock events CM_HINTSHOW on hint (CM_BASE + 48) mouse wParam = 0, lParam = @THintInfo TCMDrag TCMChildKey wParam = Control, lParam = 1 if inserting else 0 no params

sent by

current OLE control if sent by removing a

sent by TDBCtrlGrid eventual data link of (Message.Result applicable) sent by to CN_KEYDOWN and CN_SYSKEYDOWN TActiveXControl

sent by internal drag (Controls.pas) and TWinControl to

sent by TApplication activation and on messages

CM_DIALOGHANDLE TApplication when (CM_BASE + 49) is read or written to handle has created, when handle then contains the new CM_ISTOOLCONTROL determine if (CM_BASE + 50) tool controls, TCustomPanel

wParam = 0, lParam = Handle when setting wParam = 1, lParam = 0 when reading

sent by DialogHandle and the applications not yet been reading the dialog Message.Result handle

no params

sent by TOLEForm to its child controls are used only by sent by

CM_RECREATEWND no params (CM_BASE + 51) TWinControl.RecreateWnd and TFieldDataLink.UpdateRightToLeft CM_INVALIDATE TWinControl.Invalidate (CM_BASE + 52) and its parent request CM_SYSFONTCHANGED IconFont is (CM_BASE + 53) TControl when from stream or DesktopFont wParam = 1 if repaint is required else 0, lParam = 0 no params

sent by to notify itself of the invalidation sent by TScreen if its changed and by reading properties changing

CM_CONTROLCHANGE when (CM_BASE + 54) removing a child CM_CHANGED TControl.Changed (CM_BASE + 55) CM_DOCKCLIENT TWinControl.DockDrop to (CM_BASE + 56) docking is CM_UNDOCKCLIENT TControl on Destroy, by (CM_BASE + 57) TWinControl.DoUnDock and on removing a CM_FLOAT drag/dock routines (CM_BASE + 58) floating CM_BORDERCHANGED when (CM_BASE + 59) BevelWidth styles CM_BIDIMODECHANGED TControl.SetBiDiMode (CM_BASE + 60)

TCMControlChange

sent by TWinControl inserting or control

wParam = 0, lParam = Self TCMDockClient

sent by

sent by determine whether allowed or not

TCMUndockClient

sent by

TCustomDockForm child control TCMFloat sent by internal to make a control no params sent by TWinControl BorderWidth or are changed no params sent by

CM_PARENTBIDIMODECHANGEDno params places (in (CM_BASE + 61) CM_BIDIMODECHANGED, when from a stream, custom from from BiDiMode of and when created)

sent at various response to reading a control when reading a a stream, when TApplication changes TCustomRichEdit is

CM_ALLCHILDRENFLIPPED (CM_BASE + 62) TWinControl.DoFlipChildren CM_ACTIONUPDATE TContainedAction.Update (CM_BASE + 63) CM_ACTIONEXECUTE TContainedAction.Execute (CM_BASE + 64)

no params

sent by

wParam = 0, lParam = Action wParam = 0, lParam = Action

sent by

sent by

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 (CM_BASE + 66) TControl.SendDockNotification response to CM_VISIBLECHANGED and WM_SETTEXT CM_MOUSEWHEEL message (CM_BASE + 67) the registered message or (not TWInControl TCMMouseWheel general mousewheel generated either by mouse wheel WM_MOUSEWHEEL Win95) and sent by sent by which is executed in

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 CN_BASE CN_CHAR CN_CHARTOITEM CN_COMMAND CN_COMPAREITEM CN_CTLCOLORBTN CN_CTLCOLORDLG CN_CTLCOLOREDIT CN_CTLCOLORLISTBOX CN_CTLCOLORMSGBOX CN_CTLCOLORSCROLLBAR CN_CTLCOLORSTATIC CN_DELETEITEM CN_DRAWITEM CN_KEYDOWN CN_KEYUP CN_HSCROLL CN_MEASUREITEM CN_NOTIFY CN_PARENTNOTIFY CN_SYSKEYDOWN CN_SYSCHAR CN_VKEYTOITEM CN_VSCROLL Value $BC00 CN_BASE + WM_CHAR CN_BASE + WM_CHARTOITEM CN_BASE + WM_COMMAND CN_BASE + WM_COMPAREITEM CN_BASE + WM_CTLCOLORBTN CN_BASE + WM_CTLCOLORDLG CN_BASE + WM_CTLCOLOREDIT CN_BASE + WM_CTLCOLORLISTBOX CN_BASE + WM_CTLCOLORMSGBOX CN_BASE + WM_CTLCOLORSCROLLBAR CN_BASE + WM_CTLCOLORSTATIC CN_BASE + WM_DELETEITEM CN_BASE + WM_DRAWITEM CN_BASE + WM_KEYDOWN CN_BASE + WM_KEYUP CN_BASE + WM_HSCROLL CN_BASE + WM_MEASUREITEM CN_BASE + WM_NOTIFY CN_BASE + WM_PARENTNOTIFY CN_BASE + WM_SYSKEYDOWN CN_BASE + WM_SYSCHAR CN_BASE + WM_VKEYTOITEM CN_BASE + WM_VSCROLL

You might also like