devxlogo

MoveMouseCursor – Move the mouse to given coordinates

MoveMouseCursor – Move the mouse to given coordinates

Private Type POINTAPI    X As Long    Y As LongEnd TypePrivate Declare Function SetCursorPos Lib "user32" (ByVal X As Long, _    ByVal Y As Long) As LongPrivate Declare Function ClientToScreen Lib "user32" (ByVal hWnd As Long, _    lpPoint As POINTAPI) As Long' Mouse the mouse cursor.'' If a window handle is passed, the coordinates' are considered to be relative to that window's client area,' otherwise they are considered to be relative to the screen.'' In all cases, coordinates are in pixelsSub MoveMouseCursor(ByVal X As Long, ByVal Y As Long, _    Optional ByVal hWnd As Long)    If hWnd = 0 Then        SetCursorPos X, Y    Else        Dim lpPoint As POINTAPI        lpPoint.X = X        lpPoint.Y = Y        ClientToScreen hWnd, lpPoint        SetCursorPos lpPoint.X, lpPoint.Y    End IfEnd Sub

devx-admin

Share the Post: