@debasisdas & @nick.crane - Thank you for helping me!
I have successfully created dwell click application. But, I m facing some problem.
I have used a timer whose interval is set to 2 sec, so this program is initiating clicks every 2 sec. I want it to click only when my mouse does not move for 2 sec or so.
means if I move mouse continuously it should not initiate click.
Please help me out with timer syntax - Thank you!
Public Class Form1
Dim x As Integer ' X variable to store x coordinate of cursor
Dim y As Integer ' X Variable to store y coordinate of cursor
Dim x1 As Integer ' X1 Variable to store x1 new coordinate of cursor
Dim y2 As Integer 'y2 Variable to store y2 new coordinate of cursor
Private Declare Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Private Sub Mouse_Click(ByVal button As Integer, ByVal state As String)
Select Case button
Case 1
If state = "down" Then
mouse_event(2, 100, 100, 0, 0)
Else
mouse_event(4, 100, 100, 0, 0)
End If
Case 2
If state = "down" Then
mouse_event(8, 100, 100, 0, 0)
Else
mouse_event(16, 100, 100, 0, 0)
End If
Case 3
If state = "down" Then
mouse_event(32, 100, 100, 0, 0)
Else
mouse_event(64, 100, 100, 0, 0)
End If
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
x = MousePosition.X
y = MousePosition.Y
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
x1 = MousePosition.X
y2 = MousePosition.Y
If x <> x1 And y <> y2 Then
Mouse_Click(1, "down")
Mouse_Click(1, "up")
End If
x = x1
y = y2
End Sub