How can I capture keyboard input and write it to a file?

I could not find a single article that would help me. I want to make an application (console, winforms, wpf, really doesn’t matter) that works in the background (is it at startup or something like that) and writes every key pressed in a file (in any text field or the like). For example, the computer starts up, and I open IE and write in the address bar www.bla.com, and then I open the pokerstars application and write something in the login information or in the text fields; and at any time I open a text file, I find in it what was written before.

can you suggest a c # approach for this? (I use Windows 7 if that matters) thanks

0
source share
3 answers

I hope you want this for legitimate and effective purposes.

What you want to create is a keyboard hook. See this:

http://blogs.msdn.com/b/toub/archive/2006/05/03/589423.aspx

Best regards, and not evil.

+7
source

what you want to record is a key logger.

Search for KeyboardHook and you will find articles like this:

in c # or in c

0
source

What you are looking for is called a keylogger. There are many examples of writing on the Internet.

You can create a WinForms form and set the KeyPreview property to true, this way you will intercept all keystrokes, even one that are not sent to your application. You can also switch to your native language and use interceptors .

But usually keylogging is disapproving. What are you trying to accomplish?

0
source

Source: https://habr.com/ru/post/1247873/


All Articles