Hardware Delphi

Title: IsMouseOver
Question: A general function to determine if the mouse is over a vcl control.
Answer:
function IsMouseOver (Control: TControl): boolean;
var p: TPoint;
begin
{ get absolute coordinates }
if GetCursorPos (p) then begin
{ convert to relative coordinates of component }
p := Control.ScreenToClient (p);
{ coordinates within Control? }
Result := (p.x = 0) and (p.x (p.y = 0) and (p.y end
else
{ this should never happen, but who knows... }
Result := false;
end;