How to send keyboard commands to a game based on Direct-X or OpenGL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waqasmgl
    New Member
    • Nov 2007
    • 20

    How to send keyboard commands to a game based on Direct-X or OpenGL

    Hi all,

    First i m clearing one thing. This question is a general windows question and it has nothing to do with programming.

    I want to know that how can i send keyboard commands to a game based on Direct-X or OpenGL.
    I have tried SendInput and keybd_event API to send keyboard commands but it aint working on games but working perfectly on normal windows form based applications. Sending messages to a game aint work, because direct input ignores windows messages, it communicated directly with the device drivers. Please Please just tell me any way to send keyboard keys and mouse events to a game. Again only the way i m not much interested in code, but code ll be appreciated.

    Example Scenario: I m playing Need For Speed. Now my application will send it a key which is key Up, and car ll be accelerated. These commands will be sent from some kind of form based application.

    Please tell me any way or any technique to do this.

    Thanks a lot in advance to the readers and to those who will answer to this post.

    PS: I have googled for 3-4 hours to find the answer of this question SO please dont suggest me to google about it first. Thank you.
  • Death Slaught
    Top Contributor
    • Aug 2007
    • 1137

    #2
    If it's something like NFS, in short, you can't. The game detects your mouse clicks or when keys are pressed, and fires a lot of commands/scripts accordingly. To send the correct commands/scripts based on input to the game would require access and extensive knowledge of the game engine. Even then you would need a program that can run the commands/scripts while NFS is running.


    Regards, Death

    Comment

    • waqasmgl
      New Member
      • Nov 2007
      • 20

      #3
      thanx death slaught...
      Sorry i cant check my post because i found dat i have to hook direct input...

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32655

        #4
        A new (hijack) post was added in here and has since been moved to the Lounge, which is a members-only area, as Hello Bytes.

        Comment

        Working...