这样做:
先定义函数……
…………
OldWndProc, NewWndProc: Pointer;
procedure NewWndMethod (var Msg: TMessage);
…………
procedure MyProc(var Message: TMessage);
begin
....
//记得 CallWindowProc(OldWndProc, aDBgrid.Handle, msg, wParam, lParam);
end;
子类化…………
………………
NewWndProc := MakeObjectInstance (NewWndMethod);
OldWndProc := Pointer (SetWindowLong (
Form1.Handle, gwl_WndProc, Longint (NewWndProc)));
………………
最后—……
SetWindowLong (fFormHandle, gwl_WndProc,
Longint (OldWndProc));
FreeObjectInstance (NewWndProc);