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

Posts 1–10 of 10 · Page 1 of 1
[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.
[highlight="vb"]Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16[/highlight]
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..
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 Lyoto Machida 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 (:
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?
Quote Originally Posted by Lyoto Machida 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
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
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]
Its works 2 but dont post on solved threads..
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.
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us