一个简单的例子。DELPHI7+WIN2000上测试通过<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, ExtCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Panel1: TPanel;<br> procedure FormCreate(Sender: TObject);<br> private<br> FClientInstance, FPrevClientProc : TFarProc;<br> hand:THandle;<br> procedure ClientWndProc(var Message: TMessage);<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br>procedure TForm1.ClientWndProc(var Message: TMessage);<br>begin<br> case Message.Msg of<br> WM_LBUTTONDBLCLK:<br> begin<br> ShowMessage ('WM_LBUTTONDBLCLK事件');<br> end;<br> end;<br> Message.Result := CallWindowProc(FPrevClientProc, hand, Message.Msg, Message.wParam, Message.lParam);<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> hand:=Panel1.Handle;<br> FClientInstance := MakeObjectInstance(ClientWndProc);<br> FPrevClientProc := Pointer(GetWindowLong(hand, GWL_WNDPROC));<br> SetWindowLong(hand, GWL_WNDPROC, LongInt(FClientInstance));<br>end;<br><br>end.<br><br>