Thread: How to Mimick a user's keystrokes

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    1

    Question How to Mimick a user's keystrokes

    I am trying to write a program that will eventually mimick a user. Basically, I need to somehow have my program automatically execute various keystrokes, but I am unsure how to do this. For example, when the user clicks a button, say "Hello", I want my program to switch programs by making the computer think the user hit alt+tab then I want it to type/paste the word "Hello" into the selected field of that program.

    In other words, how would I write code that will, for lack of a better phrase, type predefined keys for the user?

    Thanks for any help.

  2. #2
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    To send keys to the active window, look up the Send and SendWait methods of the SendKeys class.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function validation.
    By Fhl in forum C Programming
    Replies: 10
    Last Post: 02-22-2006, 08:18 AM
  2. open() file creation weirdness
    By itsme86 in forum C Programming
    Replies: 10
    Last Post: 09-27-2004, 05:22 PM
  3. Finding users on a network and messaging them.
    By Necrodeemer in forum C++ Programming
    Replies: 3
    Last Post: 05-04-2003, 02:04 PM
  4. Windows ntfs perms
    By wp_x in forum Tech Board
    Replies: 3
    Last Post: 03-04-2003, 06:38 AM