Question

I'm interesting in gathering usage metrics for an application that I did not write and have no control over. This is a applicaiton running on Windows.

My plan for this is to register a global windows hook for mouse and keyboards events, and record those events for windows that have pre-determined titles or other identifable attributes.

Using this data, I hope to be able to determine how a user uses the application in question. What buttons they click and when, as well as common workflows. Etc.

Any thoughts on this idea? Are there 3rd party products or libraries that would facilitate this solutions that do not require modification of the existing application?

Was it helpful?

Solution

I assume (hope) this is for something like usability experimentation and not nefarious purposes.

The approach you outlined seems reasonable. The drawbacks of global hooking are:

  1. It's a burden on every process, since your hook code will be injected into every process.
  2. It can run into security barriers. For example, if you're hooking from a medium integrity level app, I don't think you'll be able to hook a high integrity level app. Also, you're essentially creating a keylogger, so don't be surprised if some anti-malware app flags you as possibly spyware.
  3. You may need a 64-bit version and a 32-bit version.

One way to mitigate the impact you have on the machine is to use a more targeted hook: find the particular process you care about, enumerate its threads, and hook only those.

Spy++, a developer tool for tracking Windows messages, does much of what you want, but I'm not sure if you could leverage it for your purpose. I'm not aware of any other tools or frameworks for doing this kind of instrumentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top