procedure TForm1.Button1Click(Sender: Tobject);
begin
FOldWndProc:= image1.WindowProc;
image1.WindowProc:= Form1.NewWindowProc;
end;
procedure TForm1.NewWindowProc(var AMsg: TMessage);
begin
if AMsg.Msg = WM_PAINT then
begin
//Process message
end
else if AMsg.Msg = WM_MOUSEMOVE then
begin
//Process message
end
else
FOldWndProc(AMsg); //Call default window process method
end;