Quote:
Originally posted by dinesh123
Dim x0 As Long
Dim y0 As Long
Dim b As Boolean
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Command1_Click()
b = True
Dim pt As POINTAPI
GetCursorPos pt
x0 = pt.X
y0 = pt.Y
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If b Then SetCursorPos x0, y0
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If b Then SetCursorPos x0, y0
End Sub
or you can also Hide the mouse cursor using ShowCursor API
Public Declare Function ShowCursor Lib "user32" (ByVal lShow As Long) As Long