How can I make my component to detect the mouse position? <p>I want to write a little component which shows me on which control mouse is currently over. When it spot the choosen control it should fire the messaage (for example).</p> <p>But I don't know what should I do to form to get the position of the mouse all the time. This is what I've got:</p> <pre><code> TMouseOverControl = class(TComponent) private fActive: Boolean; fControl: TWinControl; public constructor Create(AOwner: TComponent); override; procedure Loaded; override; procedure SpotIt; published property Active: Boolean read fActive write fActive; property Control: TWinControl read fControl write fControl; // when mouse is over this control show me the message end; constructor TMouseOverControl.Create(AOwner: TComponent); begin // nothing interesting here // don't have control property here - so overrided the loaded method inherited; end; procedure TMouseOverControl.Loaded; begin inherited; // TForm(Owner).Mo.... := SpotIt.... // what should i do to make it work? end; procedure TMouseOverControl.SpotIt; begin // IsMouseOverControl is easy to implement // http://delphi.about.com/od/delphitips2010/qt/is-some-delphi-tcontrol-under-the-mouse.htm if IsMouseOverControl(Control) then ShowMessage('Yep, U got it!'); end; </code></pre> <p>Any ideas?</p>