Talking[Help] Keybinding in VB [Solved]

Posts 15 of 5 · Page 1 of 1
[Help] Keybinding in VB [Solved]
I have always wanted to learn VB and C so I finally got off my tail and began my journey.

I have been studying so much my brain is beginning to bleed, about simple spam bot scripts and am getting no where, why?

All the tutorials I have read pertaining to spam bots use timers and I do not want timers, all I want is hotkeys to activate my text boxes.

for instance, if I were to bind F8 to textbox1, randomly clicking f8 will spam my message one time per click relying on no timers and only on my input.

I can not for the life of me figure out how to do it when like I said, all spam bots I have read up on rely on timers to work.

I have spent 3 days researching the subject so please dont tell me to google it when I have, oh Lord I have.

All I ask is if its possible to do it the way I wish, or do I still have to add timers?
I do not want someone to do it for me, I just need a little nudge in the right direction.
We all have to start somewhere, right?

thanks you for your time.
Meh, to keybind a line of string isn't too hard, though you will HAVE to use a timer for the hotkeys (or a loop in a separate thread...whatever) =. The reason behind this is that your program needs to constantly check if your desired key is being pressed at any time. You can't handle any events as your form won't be focused a lot of the time so timers it is.

[highlight=vb.net]
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vk As Int32) As Int16

Private KeyBinding As New Dictionary(Of Integer, String)
[/highlight]

This is how you add a new item to be bound:
[highlight=vb.net]
KeyBinding.Add(Keys.F5, "Hello World")
[/highlight]

We've tied "F5" and Hello World together. Now we just need to check if the hotkey is pressed:

[highlight=vb.net]
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
For each entry As KeyValuePair(Of Integer, String) in KeyBinding
If GetAsyncKeyState(entry.Key) > 0 Then SendKeys.Send(entry.Value)
Next
End Sub
[/highlight]

Enjoy.
Thanks Jason for the quick reply.

Its not that I want a spammer, its that I wish to learn

I do have a spammer that was make in 2005 and has no buttons.

example:
f6 [text box]
f7 [text box]
f8 [text box]
f9 [text box]

what I plan on doing is the same thing but adding in the ability for it to read from notepads and spam those texts.
I figure learning that should help me understand more about the command lines and their meanings.

thanks again for your assistance.
Quote Originally Posted by newtoVB View Post
Thanks Jason for the quick reply.

Its not that I want a spammer, its that I wish to learn

I do have a spammer that was make in 2005 and has no buttons.

example:
f6 [text box]
f7 [text box]
f8 [text box]
f9 [text box]

what I plan on doing is the same thing but adding in the ability for it to read from notepads and spam those texts.
I figure learning that should help me understand more about the command lines and their meanings.

thanks again for your assistance.
Alright cool, good to see some new people that actually wanna learn, opposed to making the spammer and being content with that.

Topic marked solved, no more posting unless it's directly relevant and the thread is < 7 days old
Also take a look at the keysconverter.

You can convert strings to an integer.

Let's say you let someone customize the hotkey with a textbox.

Textbox.text = "F8"

[highlight=VBNET]
Dim keyC as new keysconverter

if getasynckeystate(keyC.convertfromstring(Textbox.te xt)) Then
[...]
End If[/highlight]
Posts 15 of 5 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Need help?