Just a hopefully simple question, I have a hotkey that turns a spammer on, just one to turn it off. I want the same key that turns it on, to turn it off.
Code:
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Short
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
spam.Enabled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
spam.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hotkeys.Tick
Dim f7 As Boolean
f7 = GetAsyncKeyState(Keys.F7)
If f7 = True Then
spam.Enabled = True
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles spam.Tick
SendKeys.Send(TextBox1.Text)
SendKeys.Send("{Enter}")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
hotkeys.enabled = True
spam.Enabled = False
hotkeys2.Enabled = True
spam2.Enabled = False
End Sub
Private Sub ComboBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.TextChanged
Try
spam.Interval = Val(ComboBox2.Text)
If Val(ComboBox2.Text) = 0 Then
spam.Interval = 100
End If
Catch
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
spam2.Enabled = True
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
spam2.Enabled = False
End Sub
Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged
Try
spam.Interval = Val(ComboBox1.Text)
If Val(ComboBox1.Text) = 0 Then
spam.Interval = 100
End If
Catch
End Try
End Sub
Private Sub hotkeys2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hotkeys2.Tick
Dim f8 As Boolean
f8 = GetAsyncKeyState(Keys.F8)
If f8 = True Then
spam2.Enabled = True
End If
End Sub
Private Sub spam2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles spam2.Tick
SendKeys.Send(TextBox2.Text)
SendKeys.Send("{Enter}")
End Sub
End Class
An idea on how to accomplish this, or even a helpful link would be appreciated
The reason I want a 'toggle' key, is to leave more keys accessible if I wanted
to add more features. Thanks to Blubb1337 I managed to learn how to make global hotkeys without a module ;o But now I'm having trouble making the same hotkey do different things.
My assumption would be something like:
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hotkeys.Tick
Dim f7 As Boolean
f7 = GetAsyncKeyState(Keys.F7)
If f7 = True Then
If
spam.Enabled = True Then
If F7 = True Then
spam.Enabled = False
End If
End If
End Sub
Then again, I absolutely SUCK at coding ;o