Tuesday, February 14, 2006

Moving the mouse pointer


To move the Mouse pointer with no user's action, you can use a timer and put the following code in it's OnTimer event:



    procedure TForm1.Timer1Timer(Sender: TObject);

    var

       pt:tpoint;

    begin

      getcursorpos(pt);

      pt.x := pt.x + 1;

      pt.y := pt.y + 1;

      if pt.x>=screen.width-1 then setcursorpos(0,pt.y);

      if pt.y>=screen.height-1 then setcursorpos(pt.x,0);

    end;

0 Comments:

Post a Comment

<< Home