type
TForm1 = class(TForm)
CheckListBox1: TCheckListBox;
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
OldWndProc:TWndMethod;
procedure NewWndProc(var Msg:TMessage);Message WM_VSCROLL;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.NewWndProc(var Msg: TMessage);
begin
if Msg.Msg = WM_VSCROLL then ShowMessage('接收到滚动条消息');
if Assigned(OldWndProc) then
OldWndProc(Msg);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldWndProc:=CheckListBox1.WindowProc;
CheckListBox1.WindowProc:=NewWndProc;
end;