Einzelnen Beitrag anzeigen

Schubi

Registriert seit: 4. Nov 2003
Ort: Happurg (Nürnberg)
331 Beiträge
 
Delphi 2006 Professional
 
#2

Re: Mausbewegung(!) simulieren

  Alt 24. Apr 2007, 13:05
Delphi-Quellcode:
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
       (GetAsyncKeystate(Vk_Escape) <> 0) or
       (GetAsyncKeystate(Vk_Space ) <> 0) or
       ((mm.X=X) and (mm.Y=Y));
end;
Tut genau was du suchst, denke ich...
Christian Schubert
Ich fange gerade erst an, den Umfang meiner Ahnungslosigkeit zu begreifen...
  Mit Zitat antworten Zitat