Mouse - pegar o nome do componente que esta sob o mouse

Top  Previous  Next

procedure TForm1.Timer1Timer(Sender: TObject);

var

  p: TPoint;

  i: THandle;

  x: Integer;

  s: array [ 0..2047 ] of char;

begin

  GetCursorPos ( p );

  i := WindowFromPoint ( p );

  GetWindowText ( i, s, x );

  Label1.caption := intToStr ( i ) + ' : ' + s;

end;