Pohyb myši do určitého bodu danou rýchlosťou
Najmä pri tutoriáloch môže byť vhodné presunút kurzor myši na miesto, kde sa očakáva kliknutie.
procedure MoveMouse (X,Y,Speed: Integer); var wd, hh : integer; mm : TPoint; begin if Speed < 1 then Speed := 1; wd := X; hh := Y; Repeat sleep(speed); Application.Processmessages; GetCursorPos(mm); with mm do begin If x > wd then dec(x) else If x < wd then inc(x); If y > hh then dec(y) else If y < hh then inc(y); end; SetCursorPos(mm.x,mm.y); until (GetAsyncKeystate(Vk_Return) <> 0) or ((mm.X=X) and (mm.Y=Y)); end; procedure TForm1.Button1Click(Sender: TObject); begin MoveMouse (0,0,10); end;