0

I just inherited a C# windows application codebase. It's a relatively large application with lots and lots of UI "elements" that I believe may have been added by the previous developer with little to no interaction with the actual clients. This application is a robotics control system, it runs at a manufacturing facility, and it has some of the most complex UIs I have ever seen (forms inside of forms inside of tabbed elements inside of etc...)

One of the first things I want to do, is learn about how the actual plant floor associates interact with this application. I have already sent out a survey to the different supervisors, but I would like some empirical data as well.

What I would like to do:

I would like to somehow, capture every time a user presses a button, control, etc... and record it to a file. Something simple like:

timestamp,name of control,any other cool data I can capture (program run state, for example.)

The difficulty is that I'm not really a C# expert at this point, and I can't figure out the appropriate way to add some sort of global behavior to my application which does this, and doesn't impact existing functionality. Any advice would be greatly appreciated.

earino
  • 2,885
  • 21
  • 20
  • As for the keyboard keys pressed have you thought about a [Global keyboard hook](http://stackoverflow.com/questions/13998131/get-key-from-any-process) ? – phadaphunk Apr 22 '13 at 17:42
  • Chapter 7 of http://www.manning.com/hazzard/ has a section on IL rewriting. You could use it to inject a logging statement at the start of every click handler. There might be an easier way though... – N_A Apr 22 '13 at 17:43
  • @mydogisbox IL injection may take a lot more effort than doing plain hook. – danish Apr 22 '13 at 18:13
  • @danish Probably, that's why it's a comment not an answer ;-) – N_A Apr 22 '13 at 19:06

1 Answers1

0

Global keyboard and mouse hooks would be the way to go. Unless someone knows the design thoroughly and can comment how to extend existing functionality. it is going to be bit difficult.

danish
  • 5,550
  • 2
  • 25
  • 28
  • I'm perfectly willing to start with global keyboard and mouse hooks. Any chance you can point me to an example of how I would go about doing this thing? :) – earino Apr 22 '13 at 17:46
  • @earino please refer to my previous question. I posted a link in the comments of your question. It is clearly explained everystep is there and it's working. **Remember** the global hook will catch **All** inputs. even the ones when your application doesnt have the focus. – phadaphunk Apr 22 '13 at 17:55