0

I want to create a small process in C# that counts my keystrokes and saves them to an xml file. One entry for every hour. I want to create some statistics about the count of my typing with this. I imagine the xml file:

Structure:

<keystrokes>
    <entry time = [date and time ]>
        <key id = [Key-id]>[Amount of keystrokes]</key>
        <key id = [Key-id]>[Amount of keystrokes]</key>
        .
        .

    </entry>
   .
   .
</keystrokes>

Example:

<keystrokes>
    <entry time = "25.08.2015_14:00_15:00">//counted keystrokes between 14:00 and 15:00
        <key id = "A">34</key>
        <key id = "B">45</key>
        .
        .
    </entry>
   .
   .
</keystrokes>

Update frequently the current entry. For example: write every 10 sec the counted keystrokes to the xml to prevent data loss. A perfect solution would be an integrated mouse click counter.

I hope you can explain how to get access to the keystrokes and how to work with them and C#. Thank you very much.

  • What did you try so far? SO is about concrete programming question, not general teaching topics. – MakePeaceGreatAgain Aug 25 '15 at 12:41
  • I don't know how to get access to the keystrokes. I want to know how this is possible. Wich Methods should i use? – Max Schneider Aug 25 '15 at 12:45
  • It´s not clear what exactly you mean when you say "Update frequently the current entry. For example: write every 10 sec" as you also wrote that you want to have the values of one hour instead of 10sec. – MakePeaceGreatAgain Aug 25 '15 at 12:51
  • I want that the program save the counted keystrokes every 15sec (for example) to the entry of the current hour. Only to prevent data loss if i close the thread at 14:50. But this is not my problem. I want to know how to get access to the keystrokes and how to work with them. – Max Schneider Aug 25 '15 at 13:00

1 Answers1

0

It's basically a keylogger with analytics.

To build the keylogger itself, see this SO answer. To gather statistics, I'd recommend using an SQLite database: it's very lightweight, easy to use and performant.

Community
  • 1
  • 1
Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288