Home of Gamehacking - Archiv
How to make auto keypress - Druckversion

+- Home of Gamehacking - Archiv (http://archiv-homeofgamehacking.de)
+-- Forum: Coding (http://archiv-homeofgamehacking.de/forumdisplay.php?fid=15)
+--- Forum: Visual Basic 6, VB.NET (http://archiv-homeofgamehacking.de/forumdisplay.php?fid=19)
+--- Thema: How to make auto keypress (/showthread.php?tid=2356)



How to make auto keypress - seahongheng - 21.11.2013

Dear All!
I want to make my own auto keypress when I click start button.
I have this code on VB 2010

Public Class Form1
Declare Function keybd_event Lib "user32" Alias "keybd_event" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer) As Integer

Const KEYEVENTF_KEYDOWN As Integer = &H0 ' Press key
Const KEYEVENTF_KEYUP As Integer = &H2 ' Release key
Const VK_SPACE As Integer = &H20
Const vk_b As Integer = &H22
Private Sub CmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdStart.Click
Timer1.Start()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Timer1.Enabled = False
Timer2.Enabled = False
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
keybd_event(CByte(66), 0, 17, 0)
keybd_event(CByte(66), 0, 17, 0)
End Sub

Private Sub CmdStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdStop.Click
Timer2.Enabled = True
CmdStart.Enabled = True
End Sub
End Class

when I click start it work only on Note pad or other application but on game it not work,
any one can help me?
thank