Results 1 to 3 of 3
  1. #1
    muddy175's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Location
    idk
    Posts
    7
    Reputation
    10
    Thanks
    0

    VB Hold Key Down

    well, I kind of want to make a program that holds down keys while it clicks in another key.
    What I want it to do is hold ctrl and ALT down while it clicks the down arrow.

    Sendkeys.send doesn't work because it doesn't hold the key down. it just cycles through the button press. over and over again.

    Any help would be appreciated.

  2. #2
    willrulz188's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Ohio?
    Posts
    1,786
    Reputation
    35
    Thanks
    231
    My Mood
    Amazed

    C+P

    Code:
    Private Sub letkeygo(ByVal key As Byte)
                Dim kb_delay As Integer
                Dim kb_speed As Integer
                SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, kb_delay, 0)
                SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, kb_speed, 0)
                keybd_event(key, MapVirtualKey(key, 0), 2, 0)
            End Sub
    
            Private Sub HoldKeyDown(ByVal key As Byte)
                Dim kb_delay As Integer
                Dim kb_speed As Integer
                SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, kb_delay, 0)
                SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, kb_speed, 0)
                keybd_event(key, MapVirtualKey(key, 0), 0, 0)
            End sub
    Question ALL statements! ?
    You're in denial that you're in denial. ?
    [img]https://i360.photobucke*****m/albums/oo45/blood188/Untitled-3.jpg?t=1284590977[/img]

  3. #3
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    The above is NOT the way to do it. Use the keybd_event API and signal all the keydowns before you signal the keyup. Here's some generic methods to get you started.

    Code:
    <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _
    Private Shared Function keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As UInt32, ByVal dwExtraInfo As UIntPtr) As Boolean
    End Function
    
    Private Sub InvokeKeydown(ByVal key As Keys)
        Dim vk As Byte = CType(key, Byte)
        keybd_event(vk, 0, 0, UIntPtr.Zero)
    End Sub
    
    Private Sub InvokeKeyup(ByVal key As Keys)
        Dim vk As Byte = CType(key, Byte)
        keybd_event(vk, 0, 2, UIntPtr.Zero)
    End Sub
    
    Private Sub InvokeKeypress(ByVal key As Keys, Optional ByVal holdLength As Integer = 10)
        InvokeKeydown(key)
        Threading.Thread.Sleep(holdLength)
        InvokeKeyup(key)
    End Sub
    So, call InvokeKeydown on the first key, then on the second and finally the third. Then InvokeKeyup on them in reverse order.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    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)

Similar Threads

  1. Hold Down Arrows to Enable Hacks?
    By adrian9616 in forum WarRock - International Hacks
    Replies: 15
    Last Post: 11-25-2009, 05:32 AM
  2. Can't Nothing Hold Me Down
    By Inna in forum Entertainment
    Replies: 0
    Last Post: 10-10-2009, 06:34 PM
  3. Playing Gunzonline When it's down
    By CrazyDeath in forum Gunz General
    Replies: 18
    Last Post: 02-09-2006, 12:24 PM
  4. GunZ is Down ATM so STFU
    By Neogaiden in forum Gunz General
    Replies: 1
    Last Post: 01-17-2006, 04:02 AM
  5. Server down for tonite - 1/1/06 till 2/1/06
    By Dmx in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 19
    Last Post: 01-02-2006, 10:51 PM