Thread: How would i make a program press a key as if it had been pressed on the keyboard?

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    33

    How would i make a program press a key as if it had been pressed on the keyboard?

    Hello I would like to know how to press a key as if it had been pressed on the keyboard in a program. I would also like to know how to read input from a xbox 360 controller. I want to know how to do this so that I can add joystick support to a few mmos that I play that do not already have it. If you know how to do this please comment. Thank you for reading

    BTW I am using C 99

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Windows has XInput for using an Xbox 360 controller:
    XInput Game Controller APIs (Windows)

    For synthesizing keystrokes, try one of

    keybd_event function (Windows)

    SendInput function (Windows)
    Last edited by oogabooga; 12-28-2013 at 01:31 PM.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Oct 2013
    Posts
    33
    Thanks, I hope I can get this to work

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How could I make my program switch Sleep() while enter is pressed?
    By cplusplusnoob in forum C++ Programming
    Replies: 2
    Last Post: 03-26-2012, 05:32 PM
  2. C program to press keyboard keys
    By meadhikari in forum Windows Programming
    Replies: 9
    Last Post: 03-26-2010, 12:36 AM
  3. Wich key is pressed on the keyboard
    By Coding in forum Windows Programming
    Replies: 0
    Last Post: 03-20-2008, 02:20 PM
  4. Replies: 2
    Last Post: 07-25-2003, 03:01 AM
  5. Checking to see what is being pressed on the Keyboard
    By SmashBro in forum C++ Programming
    Replies: 7
    Last Post: 09-12-2002, 06:00 PM