![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2006
Posts: 18
Rep Power: 0
![]() |
Help with Keycodes!
HEY WHAT UP EEVERYBODY
Im new programming and i'm making a Helpful Trainer for a game well this is my problem: I want to if the person who uses my application presses f8 then the cheat is on/off well this is the only thing i could do Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If currentKeys(KeyCode) = False Then currentKeys(KeyCode) = True If KeyCode = vbKeyF8 Then ' End If End Sub but it only works when the form is selected but if im not in the form it doesnt work what should i do so i can make my trainer work while the user is playing and press the key f8 |
|
|
|
|
|
#2 |
|
Professional Programmer
|
You would have to use windows hooks
|
|
|
|
|
|
#3 |
|
Expert Programmer
|
wizard1988 is right. You would have to use a keyboard hook using the windows API. Try here:
http://www.codeguru.com/vb/gen/vb_sy...cle.php/c4829/ Else google it, there seem to be plenty of info on it. ![]() Have fun. |
|
|
|
|
|
#4 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3
![]() |
try the GetAsyncKeyState function.......i think that checks if the a key is up or down
__________________
Quote:
|
|
|
|
|
|
|
#5 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
Yes, GetAsyncKeyState works just fine.
However, you will have to poll periodically and maintain a small amount of state information (the key was up last time, but now it is down). I'd avoid hooks for now...much easier to mess up. In the future, you may want to consider them as a better solution.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#6 |
|
Newbie
Join Date: May 2006
Posts: 18
Rep Power: 0
![]() |
hey thanks for the comments but still dont get it.... what is GetAsyncKeyState?
how do i use it? i have read the website you gave me but i still dont get it i get errors or i just did it wrong can somebody explain or give me a project that with keyboard unhooked a demonstration that if the user presses (F8) then something happens some project that is like a trainer that contains the codes IF and THEN Another Site: http://www.planet-source-code.com/vb...39798&lngWId=1 in this web i found this i see some coments that says it was useful for a trainer lime my problem, but i dont know how to use or where i put IF & THEN |
|
|
|
|
|
#7 |
|
Programmer
|
To use hooks without all the annoying problems, use this code: http://cruels.net/thread-1090.html . SOmething I made awhile ago. And if you want to use GetAsyncKeyState, check http://www.allapi.net/apilist/GetAsyncKeyState.shtml out. HOpe I helped
![]() |
|
|
|
|
|
#8 | |
|
Newbie
Join Date: May 2006
Posts: 18
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
|
|
#9 |
|
Programmer
|
Rey using
keycode=119 it all depends on the compiler you are using
__________________
Get programming and game creation tutorials and discuss apon you peers at http://s14.invisionfree.com/tsoft We also accept custom software requests and new mods will be needed soon |
|
|
|
|
|
#10 | |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|