可不可以sleep一下
procedure MoveMouseIntoControl(AWinControl: TWincontrol);
var
rtControl: TRect;
oldP,newP:TPoint;
i,j :integer;
begin
rtControl := AWinControl.BoundsRect;
MapWindowPoints(AWinControl.Parent.Handle, 0, rtControl, 2);
GetCursorPos (oldP);
newP.x :=rtControl.Left + (rtControl.Right - rtControl.Left) div 2;
newP.y :=rtControl.Top + (rtControl.Bottom - rtControl.Top) div 2;
i :=oldP.x; j:=oldP.y;
while (i<>newP.x) or (j<>newP.y) do
begin
if i>newP.x then dec(i); if i<newP.x then inc(i);
if j>newP.y then dec(j); if j<newP.y then inc(j);
SetCursorPos (i,j);
Sleep(1);
end;
PostMessage(AWinControl.Handle, WM_LBUTTONDOWN, 0, 0);
PostMessage(AWinControl.Handle, WM_LBUTTONUP, 0, 0);
end;