Thread: hot to send a key message to another program?

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    4

    Question hot to send a key message to another program?

    I am attempting to create a bot for a fps game that can make another program think i am holding down the shift button(because thats the button you hold down when you want your character to run) when i press a key (for example F5) once and stop when i press it again.

    this is a small part of a program.
    So how would i go about writing that? if someone could just get me started i could probobly take it from there.
    Last edited by diducktape; 07-19-2009 at 08:21 PM.

  2. #2
    Registered User
    Join Date
    Aug 2006
    Posts
    163
    You'll probably want to use the keybd_event function.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    4
    but how to i make it keep sending the shift down message to the game? , that was my main problem

  4. #4
    Registered User
    Join Date
    Aug 2006
    Posts
    163
    Send the message that the shift key has been pressed down, but never send a message that the shift key has been released.

    (or continually send the shift key is down message if that doesn't work)

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    4
    SendMessage(hwnd, WM_KEYDOWN, VK_SHIFT, NULL);
    would that work?

    and what is the #include statment for VK? is it <winuser.h>?
    Last edited by diducktape; 07-20-2009 at 10:59 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 08-28-2008, 08:10 PM
  2. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  3. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM