[HELP] Hotkeys

Posts 1–14 of 14 · Page 1 of 1
[HELP] Hotkeys
What I would like this code to do is to when I press "F6" Say what is in "Textbox.1" and When I press "F7" it stops

Code:
Imports System.Text
Public Class Form1
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        Form2.Show()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



    End Sub

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

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If GetAsyncKeyState(Keys.F6) Then
            Timer1.Enabled = True
            SendKeys.Send(TextBox1.Text)
            SendKeys.Send("{Enter}")
        End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If GetAsyncKeyState(Keys.F7) Then
            Timer1.Enabled = False

        End If
    End Sub
End Class
declare getasynckeystate

Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
timer1_tick:

Code:
SendKeys.Send(TextBox1.Text)
            SendKeys.Send("{Enter}")
timer2_tick:

Code:
Dim f6 As Boolean
 Dim f7 As Boolean
     
        f6 = GetAsyncKeyState(Keys.F6)

        If f6 = True Then
            timer1.enabled = true
        End If

  f7 = GetAsyncKeyState(Keys.F7)

        If f7 = True Then
            timer1.enabled = false
        End If
-> ->

Code:
Public Class Form1

    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        SendKeys.Send(TextBox1.Text)
        SendKeys.Send("{Enter}")
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Dim f6 As Boolean
        Dim f7 As Boolean

        f6 = GetAsyncKeyState(Keys.F6)

        If f6 = True Then
            Timer1.Enabled = True
        End If

        f7 = GetAsyncKeyState(Keys.F7)

        If f7 = True Then
            Timer1.Enabled = False
        End If
    End Sub
End Class
What does it do?

Its like an auto clicker?
It's a spammer with hotkeys, very simple.
But it starts off spamming and I can't press Stop or anything
hit f7 for stop?

I answered you question above...lol...
I do hit F7 Dosnt work
here's your problem:
[php]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If GetAsyncKeyState(Keys.F6) Then
Timer1.Enabled = True
SendKeys.Send(TextBox1.Text)
SendKeys.Send("{Enter}")
End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If GetAsyncKeyState(Keys.F7) Then
Timer1.Enabled = False

End If
End Sub[/php]
Add the hotkey code to a timer(interval=10)
*Sighs I'll try tomorrow it's 1:30 in the morning and I'm 12 =,=

Night everyone.
Explanation

[php]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If GetAsyncKeyState(Keys.F6) Then
Timer1.Enabled = True
SendKeys.Send(TextBox1.Text)
SendKeys.Send("{Enter}")
End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If GetAsyncKeyState(Keys.F7) Then
Timer1.Enabled = False

End If
End Sub
[/php]

The actual problem with this is it is in a button click event which means it will work if you are clicking the button and pressing the keys at the same time.

If the Button is being pressed and If f7 is being pressed, you want f7 to be checked always, Someone should make a module and make it easy for everyone
How would I do this?
Nextgen has said this before but you can put 2 timers in. Timer2 will be set to an interval of 1. Put the events for the hotkeys inside timer2 so they will be checked constantly.
An interval of 100 is fine tho. And I already posted such code in my post
Idk if someone said this already. But aren't you supposed to enable the Timer2 for this to work.
The code is perfect, but it didn't work for me until I enabled it.
Posts 1–14 of 14 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us