README.md

December 5, 2022 ยท View on GitHub

get / set cursor position

Description

basically this is a quick function to show you how to set or get the position of your mouse cursor.

More Info

Submitted On
ByJames Finniss
LevelBeginner
User Rating4.0 (20 globes from 5 users)
CompatibilityVB.NET
CategoryMiscellaneous
World.Net (C#, VB.net)
Archive File

Source Code

Private Function setCursor(ByVal X As Integer, ByVal Y As Integer)
If Not X = Nothing And Not Y = Nothing Then
Dim curPoint As New Point(0, 0)
curPoint.X = X
curPoint.Y = Y
Cursor.Position = curPoint
End If
End Function

Public Function getCursor()
Dim curPoint As New Point(0, 0)
curPoint.X = Cursor.Position.X
curPoint.Y = Cursor.Position.Y
Return curPoint
End Function
'USAGE:
'to get cursor position:
MsgBox(getCursor.x & ", " & getCursor.y)
'to set cursor position:
setCursor(x coordinate, y coordinate)

i hope this snippet has helped anyone out there who is strugling with cursor functions.