Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Having Trouble with Some Simple Code

$
0
0
So I'm trying to make a simple autoclicker but it's not working and I can't for the life of me figure out why. There are no errors so I don't know what it could be, so any help would be appreciated.
Thanks!

Here's what I have:


Public Class Form1

Declare Sub mouse_event Lib "user64" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.F3 Then
Timer1.Start()
Else
If e.KeyCode = Keys.F4 Then
Timer1.Stop()
End If
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Windows.Forms.Cursor.Position = New System.Drawing.Point(Windows.Forms.Cursor.Position)
mouse_event(&H2, 0, 0, 0, 1)
mouse_event(&H4, 0, 0, 0, 1)
KeyPreview = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
MyMethod()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If TextBox1.Text = ("") Then
MsgBox("Please, put a valid number value", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "ERROR")
Else
Timer1.Interval = ((TextBox1.Text) * (1))
End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
TextBox2.Text = TextBox2.Text + 1
End Sub

Private Sub MyMethod()
End Sub

End Class

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>