Results 1 to 10 of 10
  1. #1
    Withoutwings's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    The netherlands
    Posts
    118
    Reputation
    10
    Thanks
    15
    My Mood
    Angelic

    [Help]GetAsynckeyState doesn't work for hotkey[Solved]

    Hi, I'm trying to make some hotkeys for a spammer so I can use it in-game, but programming a hotkey with the code asynckeystate and further on will not work. Not on 2010 and also not on 2008, on 2010 (vb version, for those who don't understand) it says my "stack" got unbalanced and therefor is it not a runnable application, and on 2008 it says nothing it just fails. So please help me with this problem. If you need more information about my problem please feel free to ask.
    Last edited by Withoutwings; 02-13-2011 at 02:51 PM.

  2. #2
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    [highlight="vb"]Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16[/highlight]



  3. #3
    Lyoto Machida's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Far away with girls
    Posts
    3,734
    Reputation
    133
    Thanks
    1,621
    My Mood
    Aggressive
    After Private Class Form1:
    Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    Timer with 100 + interval and Enabled:

    Code:
    Dim hotkey As Boolean
    hotkey = GetAsyncKeyState(Keys.Whateveruwant)
    If hotkey = True Then
    ' Do whatever u want..
    End if
    Hope it helps you..

    You cant test is by Debugging..Go to the folder and test it..

  4. #4
    Withoutwings's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    The netherlands
    Posts
    118
    Reputation
    10
    Thanks
    15
    My Mood
    Angelic
    Quote Originally Posted by Blubb1337 View Post
    [highlight="vb"]Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16[/highlight]
    I used that, doesn't work.

    Quote Originally Posted by -WØW'' View Post
    After Private Class Form1:
    Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    Timer with 100 + interval and Enabled:

    Code:
    Dim hotkey As Boolean
    hotkey = GetAsyncKeyState(Keys.Whateveruwant)
    If hotkey = True Then
    ' Do whatever u want..
    End if
    Hope it helps you..

    You cant test is by Debugging..Go to the folder and test it..
    Thank you, it worked (:

  5. #5
    Lyoto Machida's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Far away with girls
    Posts
    3,734
    Reputation
    133
    Thanks
    1,621
    My Mood
    Aggressive
    Quote Originally Posted by Withoutwings View Post
    I used that, doesn't work.



    Thank you, it worked (:
    lol Blubb code works 2 but you need to use it like mine 2...

    /Solved?

  6. #6
    Withoutwings's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    The netherlands
    Posts
    118
    Reputation
    10
    Thanks
    15
    My Mood
    Angelic
    Quote Originally Posted by -WØW'' View Post


    lol Blubb code works 2 but you need to use it like mine 2...

    /Solved?
    yes I know that I need to use both, I just think it's lame that he thinks that was the problem, I may be young but not that dumb.

    /solved ;D

  7. #7
    T0P-CENT's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    88
    Reputation
    14
    Thanks
    17
    My Mood
    Stressed
    Quote Originally Posted by Withoutwings View Post
    yes I know that I need to use both, I just think it's lame that he thinks that was the problem, I may be young but not that dumb.

    /solved ;D
    the problem is in 2010 when i try byval any long it gives unbalnced stack so i once tryed replacing long with integer and it worked
    @wow
    instead of diming 'nd shid
    Code:
    If GetAsyncKeyState(Keys.A)
    what ever you want
    End If

  8. #8
    Lyoto Machida's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Far away with girls
    Posts
    3,734
    Reputation
    133
    Thanks
    1,621
    My Mood
    Aggressive
    Its works 2 but dont post on solved threads..

  9. #9
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Quote Originally Posted by Withoutwings View Post
    yes I know that I need to use both, I just think it's lame that he thinks that was the problem, I may be young but not that dumb.

    /solved ;D
    None working hotkeys are often due to wrong declarations. The declarations WOW posted does partly have compability issues on x64 bit. Thus, I posted the "proper" declaration that works fine on all systems.

    @wow, a lot of unnecessary code in there..

    [highlight="vb"]If GetAsyncKeyState(Keys.F1) Then
    'bla
    End If[/highlight]



  10. The Following User Says Thank You to Blubb1337 For This Useful Post:

    T0P-CENT (02-13-2011)

  11. #10
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Nice work guys, thread is marked /solved.

    No posting unless it's a question that stems from the thread topic,AND the thread is < 7 days old.

    Cheers.

    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)