unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Edit1: TEdit;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    FOldWndProc, FNewWndProc: TFarProc;
    procedure WindowProc(var Message: TMessage);
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.WindowProc(var Message: TMessage);
begin
  Message.Result := CallWindowProc(FOldWndProc, Edit1.Handle, Message.Msg,
     Message.WParam, Message.LParam);
end;procedure TForm1.FormCreate(Sender: TObject);
begin
  FNewWndProc := MakeObjectInstance(WindowProc);
  FOldWndProc := Pointer(GetWindowLong(Edit1.Handle, GWL_WNDPROC));
  SetWindowLong(Edit1.Handle, GWL_WNDPROC, LongInt(FNewWndProc));
end;end.