Sending keystrokes

This is a discussion on Sending keystrokes within the Windows Programming forums, part of the Platform Specific Boards category; How do I send a keystroke of a function key (e.g. the F5 key) to another windows program? Thanks....

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    43

    Sending keystrokes

    How do I send a keystroke of a function key (e.g. the F5 key) to another windows program?

    Thanks.

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    You should be ok doing this with SendMessage() and using the WM_KEYUP and WM_KEYDOWN messages. The tricky part would be getting the HWND of the other window. To do that I'd just use EnumWindows().

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    do you mean your aplication is sending keystrokes or is it receiving keystrokes?

    i'm not sure but dont the applications need to have the same parent or
    acces rights for that?

  4. #4
    Registered User
    Join Date
    Dec 2004
    Posts
    43
    Quote Originally Posted by pode
    do you mean your aplication is sending keystrokes or is it receiving keystrokes?
    The program I am writing is sending a keystroke to the other application, such that the other application reacts as if I had manualy pressed the key.

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    oh you're making something like windows "on screen keyboard" program?
    it should be possible sending it with sendmessage() to the receiving applications handle.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sending keystrokes to another view
    By azeemanwer in forum C++ Programming
    Replies: 2
    Last Post: 08-28-2007, 10:41 AM
  2. sending a string as keyboard keystrokes wrongly
    By hanhao in forum C++ Programming
    Replies: 1
    Last Post: 06-29-2007, 07:49 AM
  3. Sending keystrokes
    By nate11000 in forum C++ Programming
    Replies: 17
    Last Post: 06-15-2003, 09:31 PM
  4. Sending Keystrokes
    By evilmonkey in forum C++ Programming
    Replies: 1
    Last Post: 01-31-2002, 12:18 PM
  5. Sending keystrokes to window?(PLEASE ANSWER!)
    By SyntaxBubble in forum Windows Programming
    Replies: 5
    Last Post: 11-24-2001, 08:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21