next up previous contents index
Next: SetMouseShape Up: Functions and procedures Previous: SetMouseHideWindow

SetMousePos

   

Declaration:

Procedure SetMousePos (x,y:Longint) ;

Description:

SetMosusePos sets the position of the mouse cursor on the screen. x is the horizontal position in pixels, y the vertical position in pixels. The upper-left hand corner of the screen is the origin.

While x and y are longints, only the lower 16 bits are used.

Errors:

None.

See also:

GetMouseState

Example
{example for SetMousePos}

Uses Mouse, Crt;

Begin
  If MouseFound Then
    Begin
      ShowMouse;
      While KeyPressed do ReadKey;
      Repeat
        SetMousePos(Random(80*8), Random(25*8));
        delay(100);
      Until Keypressed;
      HideMouse;
      While KeyPressed do ReadKey;
    End;
End.



Michael Van Canneyt
Thu Sep 10 13:59:33 CEST 1998