0

By the way, i'm using VB.NET.

I tried many ways but i still can't figure out how to send keys to a game. By the way i'm trying to send numbers from the keyboard, not the keypad though, the normal numbers. I tried:

SendKeys.Send("{1}")

or

SendKeys.Send(Chr(Keys.D1))

I tried those out but it doesn't work in the actual game, if i try it on something else like notepad it works.

Bpk7
  • 27
  • 5
  • What is the context of this question? I mean, what is this game you are talking about? – MarioDS Jul 03 '14 at 12:21
  • I'm talking about the game Metin2 if that helps you in any way. – Bpk7 Jul 03 '14 at 12:30
  • 3
    Probably should make sure the game is the focussed application first. – Grim Jul 03 '14 at 12:32
  • Where are you sending keys strokes from? Is the application listening for keystrokes to begin with? If so, why are you sending them? If not, why not? – John Jul 03 '14 at 15:51

2 Answers2

0

From documentation on SendKeys.Send, this command Sends keystrokes to the active application. Try clicking on the game's window, before you run the command.

If it does not help, check this out:

Community
  • 1
  • 1
Victor Zakharov
  • 25,801
  • 18
  • 85
  • 151
0

Just add a handler for the keystrokes like this:

AddHandler Main.KeyDown, AddressOf check_key

Then create a Sub to handle them like this:

Private Sub check_key(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)

' When the Enter key is pressed, trigger the event 
        If (e.KeyCode = Keys.Enter) Then
            ' do something here
        End If
End Sub
John
  • 1,310
  • 3
  • 32
  • 58