procedure TForm1.NewProc(var Message: TMessage);
var
NX,NY:Integer;
begin
if Assigned(OldProc) then
OldProc(Message);
if Message.Msg = WM_MOUSEMOVE then
begin
NX:=Message.LParamLo;
NY:=Message.LParamHi;
ShowPos(NX,NY);
end;
end;
procedure TForm1.ShowPos(X,Y:Integer);
begin
Label1.Caption:=IntToStr(X);
Label2.Caption:=IntToStr(Y);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldProc:=Image1.WindowProc;
Image1.WindowProc:=NewProc;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
if Assigned(OldProc) then
Image1.WindowProc:=OldProc;
end;