- 'Un timer
- 'Deux command 1 : pour Filmer
- 2 : Pour regarder
- 'Un checkbox (Pour prendre en compte quand la souris bouge pas ou ne pas le prendre en compte)
-
- 'Sa sert a faire bouger le curseur
- Private Declare Function SetCursorPos& Lib "user32" (ByVal X As Long, ByVal Y As Long)
- 'Sa sert a trouver la position du curseur
- Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
- 'On declare les position anciennes si la checkbox n'est pas cocher
- Dim oldx As Variant
- Dim oldy As Variant
- Dim txt As String
-
- 'Pour faciliter l'usage de L'api Get position
- Private Type POINTAPI
- X As Long
- Y As Long
- End Type
-
- Private Sub Command1_Click()
- Timer1.Enabled = True
- End Sub
-
- Private Function Pause(ByVal nbSecondes As Single)
- 'POur que qunad on regarde le curseur sa n'aille pas trop vite
- Dim Tmp As Single
- Tmp = Timer
- Do While Timer < Tmp + nbSecondes
- DoEvents
- Loop
- End Function
-
- Private Sub Command2_Click()
- Timer1.Enabled = False
-
- 'On li le fichier de positions
- Open App.Path & "\dat" For Input As #1
- Do While Not EOF(1)
- Line Input #1, a
- b = Mid(a, 1, InStr(1, a, ","))
- c = Mid(a, InStr(1, a, ",") + 1)
- a = SetCursorPos&(b, c)
- Pause (0.01)
- Loop
- Close #1
-
- End Sub
-
- Private Sub Timer1_Timer()
-
- Dim curs As POINTAPI
- a& = GetCursorPos(curs)
- ab = FreeFile
-
- 'Si la souris na pas bouger...
- If curs.X = oldx And curs.Y = oldy Then
-
- 'Et que on ne prend pas en compte kan elle bouge pas
- If Check1.Value = 0 Then
- Exit Sub
- Else
- 'Ici c'est si on la prend en compte
- GoTo s
- End If
- End If
- s:
-
- oldx = curs.X
- oldy = curs.Y
-
- 'On enregistre les positions
- Open App.Path & "\dat" For Output As #ab
- Print #ab, txt & vbCrLf & curs.X & "," & curs.Y
- If txt = "" Then GoTo ll
- txt = txt & vbCrLf & curs.X & "," & curs.Y
- GoTo ok
- ll:
- txt = curs.X & "," & curs.Y
- ok:
- Close #ab
-
- End Sub
-
- 'C'est tout!
'Un timer
'Deux command 1 : pour Filmer
2 : Pour regarder
'Un checkbox (Pour prendre en compte quand la souris bouge pas ou ne pas le prendre en compte)
'Sa sert a faire bouger le curseur
Private Declare Function SetCursorPos& Lib "user32" (ByVal X As Long, ByVal Y As Long)
'Sa sert a trouver la position du curseur
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
'On declare les position anciennes si la checkbox n'est pas cocher
Dim oldx As Variant
Dim oldy As Variant
Dim txt As String
'Pour faciliter l'usage de L'api Get position
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Function Pause(ByVal nbSecondes As Single)
'POur que qunad on regarde le curseur sa n'aille pas trop vite
Dim Tmp As Single
Tmp = Timer
Do While Timer < Tmp + nbSecondes
DoEvents
Loop
End Function
Private Sub Command2_Click()
Timer1.Enabled = False
'On li le fichier de positions
Open App.Path & "\dat" For Input As #1
Do While Not EOF(1)
Line Input #1, a
b = Mid(a, 1, InStr(1, a, ","))
c = Mid(a, InStr(1, a, ",") + 1)
a = SetCursorPos&(b, c)
Pause (0.01)
Loop
Close #1
End Sub
Private Sub Timer1_Timer()
Dim curs As POINTAPI
a& = GetCursorPos(curs)
ab = FreeFile
'Si la souris na pas bouger...
If curs.X = oldx And curs.Y = oldy Then
'Et que on ne prend pas en compte kan elle bouge pas
If Check1.Value = 0 Then
Exit Sub
Else
'Ici c'est si on la prend en compte
GoTo s
End If
End If
s:
oldx = curs.X
oldy = curs.Y
'On enregistre les positions
Open App.Path & "\dat" For Output As #ab
Print #ab, txt & vbCrLf & curs.X & "," & curs.Y
If txt = "" Then GoTo ll
txt = txt & vbCrLf & curs.X & "," & curs.Y
GoTo ok
ll:
txt = curs.X & "," & curs.Y
ok:
Close #ab
End Sub
'C'est tout!