A Button1 and Panel1 are placed on the new form, and only FORM1 receive the following message:
procedureTwincontrol.defaulthandler (varMessage);begin ifFhandle <>0 Then begin withTmessage (Message) Do begin if(MSG = wm_contextmenu) and(Parent <>Nil) Then beginResult:=Parent.perform (MSG, WParam, LParam); ifResult <>0 ThenExit; End; CaseMsg ofWm_ctlcolormsgbox. Wm_ctlcolorstatic:result:= SendMessage (LParam, Cn_base +MSG, WParam, LParam); Cn_ctlcolormsgbox. Cn_ctlcolorstatic:beginSetTextColor (WParam, Colortorgb (Ffont.color)); SetBkColor (WParam, Colortorgb (Fbrush.color)); Result:=Fbrush.handle; End; Else ifMSG = Rm_getobjectinstance ThenResult:=Integer (self)Else begin ifMSG <> WM_PAINTthen //The breakpoint here, unexpectedly received 36 129 70 131 71 3 5 127 1 124 125 48 128 241 Big string of messages Result:=CallWindowProc (Fdefwndproc, Fhandle, MSG, WParam, LParam); End; End; ifMSG = Wm_settext Thensenddocknotification (MSG, WParam, LParam); End; End Else inheritedDefaultHandler (Message);End;
Need to study ...
procedureTwincontrol.defaulthandler (varMessage);begin ifFhandle <>0 Then begin withTmessage (Message) Do begin if(MSG = wm_contextmenu) and(Parent <>Nil) Then beginResult:=Parent.perform (MSG, WParam, LParam); ifResult <>0 ThenExit; End; CaseMsg ofWm_ctlcolormsgbox. Wm_ctlcolorstatic:result:= SendMessage (LParam, Cn_base +MSG, WParam, LParam); Cn_ctlcolormsgbox. Cn_ctlcolorstatic:beginSetTextColor (WParam, Colortorgb (Ffont.color)); SetBkColor (WParam, Colortorgb (Fbrush.color)); Result:=Fbrush.handle; End; Else ifMSG = Rm_getobjectinstance ThenResult:=Integer (self)Else begin ifSelf. Name='Panel1' Then begintag:= -; //Here the breakpoint End; ifMSG <> WM_PAINT ThenResult:=CallWindowProc (Fdefwndproc, Fhandle, MSG, WParam, LParam); End; End; ifMSG = Wm_settext Thensenddocknotification (MSG, WParam, LParam); End; End Else inheritedDefaultHandler (Message);End;
In this way, you can get all the default messages received by Panel1, and they are all messages that are not normally noticed. You can also record messages in DispatchMessage, which is more clean sweep. You can also record messages in the WndProc, anyway all messages have first passed here.
Two other kinds of infrequently used: using Tappevent and Hookmessage
Message (Three ways to intercept logged messages) for window functions when creating empty windows