Sign in to follow this  

Faking Mouse/Keyboard Input

This topic is 3595 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
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

This topic is 3595 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this