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

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist