| View previous topic :: View next topic |
| Author |
Message |
Ashwin How do I cheat?
Reputation: 0
Joined: 20 Mar 2012 Posts: 5 Location: Meerut, UP, INDIA, ASIA,...
|
Posted: Wed May 29, 2013 11:11 pm Post subject: Key press problem with VB trainer |
|
|
I want to make a Trainer with VB 2010,
All i want to know is,
How will my trainer get that player is Pressing F12 in The Game,
Bcuz Keypress, Down, etc events work only when Our Form is in Focus.
Waiting for your Help.
_________________
I am a GTA VC Modder, |
|
| Back to top |
|
 |
Screitor Cheater
Reputation: 1
Joined: 26 Nov 2012 Posts: 33 Location: Venezuela
|
Posted: Thu May 30, 2013 11:17 am Post subject: |
|
|
You need to set a keyboard hook.
_________________
Everybody lies. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu May 30, 2013 2:48 pm Post subject: |
|
|
Register a global hot key, monitor for global key presses (GetAsyncKeyState) or use a system wide low level keyboard hook.
_________________
- Retired. |
|
| Back to top |
|
 |
Pingo Grandmaster Cheater
Reputation: 8
Joined: 12 Jul 2007 Posts: 571
|
Posted: Fri May 31, 2013 4:03 am Post subject: |
|
|
Heres how i do it sometimes. I did it so the code executes once if you hold the key down.
| Code: | #Region "Keys"
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal nVirtKey As Keys) As Short
Dim hKeys As New Dictionary(Of Keys, Boolean)
Public Function Keystate(ByVal key As Keys) As Boolean
If GetAsyncKeyState(key) <> 0 Then
If Not hKeys.ContainsKey(key) Then hKeys.Add(key, False)
If Not hKeys(key) Then
hKeys(key) = True
Return True
End If
Else
hKeys(key) = False
Return False
End If
Return False
End Function
#End Region |
Create a timer with low intervals, something like 50 milliseconds.
Then just use it like this in the timer
| Code: | If Keystate(Keys.Insert) Then
'Do something when Insert is pressed
End If
If Keystate(Keys.F1) Then
'Do something when F1 is pressed
End If |
_________________
|
|
| Back to top |
|
 |
|