Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   Help with Keycodes! (http://www.programmingforums.org/showthread.php?t=10113)

Darcksky May 31st, 2006 10:26 PM

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

Wizard1988 May 31st, 2006 10:46 PM

You would have to use windows hooks

Booooze Jun 1st, 2006 2:02 AM

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.

kruptof Jun 1st, 2006 3:11 AM

try the GetAsyncKeyState function.......i think that checks if the a key is up or down

Dameon Jun 1st, 2006 3:24 AM

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.

Darcksky Jun 2nd, 2006 9:10 PM

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

brownhead Jun 16th, 2006 2:55 AM

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 :D

Darcksky Jun 27th, 2006 5:53 PM

Quote:

Originally Posted by brownhead
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 :D

that kinda help the GetAsynKeystates is more easy but it get's detected >.< so i will use the other one the harder one thanks for the website.

linxis Jul 19th, 2006 3:21 PM

Rey using
keycode=119
it all depends on the compiler you are using

Game_Ender Jul 19th, 2006 6:56 PM

Quote:

Originally Posted by linxis
Rey using
keycode=119
it all depends on the compiler you are using

Umm... Visual Basic isn't its interpreted. So a compiler has nothing to do with this. Based on some of the other posts you made I am beginning to wonder whether you are just posting randomly.


All times are GMT -5. The time now is 8:03 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC