Jump to content
  • Advertisement
Sign in to follow this  
ploogle

Faking Mouse/Keyboard Input

This topic is 3839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering how I would go about faking keyboard and mouse input in c#. For example, a program that makes the computer (and all programs requiring mouse input) think that the mouse is moving in a particular direction. Also, basically the opposite of a keylogger: a program that makes the computer (and, again, all programs requiring keyboard input) think that certain keys are being pressed. I appreciate any help you guys can give me.

Share this post


Link to post
Share on other sites
Advertisement
Thanks! Can this be used in C#? My program needs to be coded in C#, since it needs to use a specific third party library only available in C#.

Share this post


Link to post
Share on other sites
http://pinvoke.net/default.aspx/user32/SendInput.html
Here is some code I found that might help, and I'd like to clarify some things:

1. I'm assuming that this part of the program actually sends the input to windows?
    // Key down the actual key-code
structInput.ki.wVk = vk;
intReturn = Win32.SendInput(1, ref structInput, (UInt32)sizeof(INPUT));


2. What headers would I need to put in the program to use Win32 and SendInput?

[Edited by - ploogle on February 9, 2008 5:33:45 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!