其实你搜一下WindowProc就能找到了。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
OldWinProc: TWndMethod;
procedure NewProc(var Message: TMessage);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.NewProc(var Message: TMessage);
begin
case Message.Msg of
WM_LBUTTONDBLCLK: ShowMessage('hello, boy');
end; //end of case
OldWinProc(Message);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldWinProc := ListBox1.WindowProc;
ListBox1.WindowProc := NewProc;
end;
end.