5

I'm trying to do some research on user activity with the app. I have found a way of making a special log module (combined with PRISM) which would use the EventManager.RegisterClassHandler static method.

My question is - how would you differentiate typing text from pressing a shortcut? In US it's a little bit easier, because Ctrl+(any letter) doesn't give you any "extension" of alphabet. So just checking if Ctrl is pressed would not work. Probably a timer or DateTime which registers time of key-press event?

Maybe I should subscribe to TextBox.TextInput and ignore the keys from KeyDown if this event is being raised?

Ole Albers
  • 8,715
  • 10
  • 73
  • 166
Michał J. Gąsior
  • 1,457
  • 3
  • 21
  • 39
  • Possible duplicate of [how could I capture keyboard input and write it to file?](http://stackoverflow.com/questions/10550355/how-could-i-capture-keyboard-input-and-write-it-to-file) – Mostafiz Apr 25 '16 at 12:47
  • 1
    Thank you for response! However, my question is not how to log keyboard, but how to differentiate typing text from pressing a shortcut in a smart and clean way. It's quite easy to log keyboard within a WPF app (and I have written above how I do that). I don't need all system key logs. I just need to know when my user writes something as opposed to when he just wants to type. – Michał J. Gąsior Apr 25 '16 at 13:08
  • 2
    Which languages use Ctrl+ a key to produce text? I've only seen keyboards using AltGr+key or Alt+ some numbers to type text and not do a function. – Draken Apr 25 '16 at 13:18
  • Ha! You're right! My mistake! And I did some hard thinking how to do it. But still - can be a possible problem for someone. Though, thank you for help. – Michał J. Gąsior Apr 25 '16 at 14:08
  • I think this question is really un-answerable. It depends on the application to decide whether or not it's typing text. I could write my own editor, which outputs `tt` whenever print screen is hit. I could also use F1-F12 as input for letters. There really isn't a way to detect 'writable' characters unless you hard-code the keycodes for English letters. – Rob Apr 26 '16 at 03:37

0 Answers0