建议看看李维的“Inside VCL”,也可以翻翻以前的老贴子,有很多这方面的内容。
一个button的click消息传递大致如下(转帖):
Project1
TApplication.Run
TApplication.HandleMessage
StdWndProc(524948,514,0,852016)
TWinControl.MainWndProc((514, 0, 852016, 0, 0, 0, 48, 13, 0, 0))
TButtonControl.WndProc((514, 0, 852016, 0, 0, 0, 48, 13, 0, 0))
TWinControl.WndProc((514, 0, 852016, 0, 0, 0, 48, 13, 0, 0))
TControl.WndProc((514, 0, 852016, 0, 0, 0, 48, 13, 0, 0))
TControl.WMLButtonUp((514, 0, 48, 13, (48, 13), 0))
TWinControl.DefaultHandler((no value))
StdWndProc(918056,273,660,524948)
TWinControl.MainWndProc((273, 660, 524948, 0, 660, 0, 660, 8, 0, 0))
TCustomForm.WndProc((273, 660, 524948, 0, 660, 0, 660, 8, 0, 0))
TWinControl.WndProc((273, 660, 524948, 0, 660, 0, 660, 8, 0, 0))
TControl.WndProc((273, 660, 524948, 0, 660, 0, 660, 8, 0, 0))
TCustomForm.WMCommand((273, 660, 0, 524948, 0))
TWinControl.WMCommand((273, 660, 0, 524948, 0))
DoControlMsg(524948,(no value))
TControl.Perform(48401,660,524948)
TButtonControl.WndProc((48401, 660, 524948, 0, 660, 0, 660, 8, 0, 0))
TWinControl.WndProc((48401, 660, 524948, 0, 660, 0, 660, 8, 0, 0))
TControl.WndProc((48401, 660, 524948, 0, 660, 0, 660, 8, 0, 0))
TButton.CNCommand((48401, 660, 0, 524948, 0))
TButton.Click
TControl.Click
TForm1.Button1Click($9637C0)