HelpHotkey help

Posts 1–5 of 5 · Page 1 of 1
Hotkey help
So i made a spammer recently Link to spammer " http://www.mpgh.net/forum/showthread.php?t=1115482 " and now im working on a update with hotkeys. So i cant figure out how to put hotkeys in the program for example i want "F11" to start the spammer and "F12" to stop it im working in Visual Studio 2013. So it would be really nice if some one could help me with this
hello,
here's the solution your problem:
Private Sub Button1_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles Button1.KeyDown
If e.KeyCode = Keys.F10 Then
Me.Timer1.Start()
e.Handled = True
End If
Private Sub Button2_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles Button2.KeyDown
If e.KeyCode = Keys.F11 Then
Me.Timer1.Stop()
e.Handled = True
End If
End Sub
Quote Originally Posted by thedebutent View Post
hello,
here's the solution your problem:
Its not working
register hotkeyfunction....

https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx

Example
Code:
    Public Const WM_HOTKEY As Integer = &H312
    Public Const NULL As Integer = &H0\

    Public Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer
    Public Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer) As Integer

    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call RegisterHotKey(Me.Handle, 1, NULL, Keys.F1)
        Call RegisterHotKey(Me.Handle, 2, NULL, Keys.F2)
        FontComboBox1.Populate(True)
    End Sub

    Private Sub MainForm_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        Call UnregisterHotKey(Me.Handle, 1)
        Call UnregisterHotKey(Me.Handle, 2)
        Application.ExitThread()
    End Sub

    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        If m.Msg = WM_HOTKEY Then
            Dim id As IntPtr = m.WParam
            Select Case (id.ToString)
                Case "1" : SpamText()
                Case "2" : RichTextBox1.Text = ""
            End Select
        End If
        MyBase.WndProc(m)
    End Sub



    Public Function HandleSendKeys(ByVal Richtextbox1 As String) As String
        Richtextbox1 = Replace$(Richtextbox1, "{", Chr(1) & "{" & Chr(2))
        Richtextbox1 = Replace$(Richtextbox1, "}", Chr(1) & "}" & Chr(2))
        Richtextbox1 = Replace$(Richtextbox1, Chr(1), "{")
        Richtextbox1 = Replace$(Richtextbox1, Chr(2), "}")
        Richtextbox1 = Replace$(Richtextbox1, "+", "{+}")
        Richtextbox1 = Replace$(Richtextbox1, "^", "{^}")
        Richtextbox1 = Replace$(Richtextbox1, "%", "{%}")
        Richtextbox1 = Replace$(Richtextbox1, "~", "{~}")
        Richtextbox1 = Replace$(Richtextbox1, "(", "{(}")
        Richtextbox1 = Replace$(Richtextbox1, ")", "{)}")
        Richtextbox1 = Replace$(Richtextbox1, "[", "{[}")
        Richtextbox1 = Replace$(Richtextbox1, "]", "{]}")
        If CheckBox1.Checked = True Then
            Richtextbox1 = Replace$(Richtextbox1, " ", "*")
        End If
        HandleSendKeys = Richtextbox1
    End Function

    Sub dELAYS(ByVal Interval As Integer)
        System.Threading.Thread.Sleep(Interval)
    End Sub

    Public Sub SpamText()
        RichTextBox1.ReadOnly = True : TextBox1.ReadOnly = True : TextBox2.ReadOnly = True
        Lines = RichTextBox1.Lines
        If Lines.Count > 0 Then
            For Each strLine As String In Lines
                If CheckBox2.Checked Then : SendKeys.Send(TextBox2.Text) : End If
                    SendKeys.Send(HandleSendKeys(strLine)) : SendKeys.Send("{ENTER}") : If (Not TextBox1.Text = Nothing) Then dELAYS(TextBox1.Text) Else 
            Next
            RichTextBox1.ReadOnly = False : TextBox1.ReadOnly = False : TextBox2.ReadOnly = False
        End If
    End Sub
End Class
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?