On the top of ur form, add this:
And in a timer, add this:Private Declare Function key Lib "User32" Alias "GetAsyncKeyState" (ByVal Key As Keys) As Keys
If key(Keys.ControlKey) And Keys.W Then
End If
Hi everyone, how can I send several keys at the same time, per example "ctrll+tab" so I can change the tab in firefox or "ctrl+w"?
I'd appreciate your help,
Thanks in advance,
Omanel
On the top of ur form, add this:
And in a timer, add this:Private Declare Function key Lib "User32" Alias "GetAsyncKeyState" (ByVal Key As Keys) As Keys
If key(Keys.ControlKey) And Keys.W Then
End If
Thank me if I helped!
Help me raise my Habamon!
He wants to send them, not check if they are pressed, I guess.
I already know how to do it, found it on msdn
If someone's Intrested:
https://msdn.microsof*****m/en-us/libr...8VS.80%29.aspx
(I think there's no problem in posting that link since it's a neutral and safe website)
Last edited by omanel; 07-05-2010 at 10:46 PM.
Okay add these declarations and constants (just under "Public Class Form1"):
[php]
Public Declare Function keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) As Long
Const KEYEVENTF_KEYUP = &H2
[/php]
Then add this sub procedure:
[php]
Private Sub press(ByVal mykey1 As Keys, ByVal mykey2 As Keys)
keybd_event(mykey1, 0, 0, 0)
keybd_event(mykey2, 0, 0, 0)
keybd_event(mykey1, 0, KEYEVENTF_KEYUP, 0)
keybd_event(mykey2, 0, KEYEVENTF_KEYUP, 0)
End Sub
[/php]
Then to utilize this,
[php]
Press(Keys.ControlKey, Keys.W) 'this will press Ctrl + W)
[/php]
FLAMESABER originally gave me a similar snippet, I just modified it to press two keys.
Not sure it works though :P Don't have VB right nao. It should though.
J-Deezy
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
if your just using firefox as an example, and your really planning on using this for a game it wont work there different add me on msn if your doing this for a game and ill help you get it to work
It will work anywhere.
@Deezy: Slight modification to your code.
^^ This will work better !!Code:Private Sub press(ByVal mykey1 As Keys, ByVal mykey2 As Keys) keybd_event(mykey1, 0, 0, 0) keybd_event(mykey2, 0, 0, 0) System.Threading.Thread.Sleep(500) keybd_event(mykey1, 0, KEYEVENTF_KEYUP, 0) keybd_event(mykey2, 0, KEYEVENTF_KEYUP, 0) End Sub
Hmm I see But If you hold the keys down for half a second, multiple tabs will be opened etc.
Maybe reduce it to 100 instead of 500
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
I believe he did with the MSDN link he posted earlier.
Marking solved.
Here's a source code of a application w/ 2 buttons and 1 timer that changes per example your tab in firefox etc.
[html]Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
SendKeys.Send("^({tab})")
End Sub
End Class[/html]
[html]SendKeys.Send("^({tab})")[/html]
That equals "ctrl+tab"
@lolland, ok, just awnsering FLAMESABER.
Hassan (07-06-2010)