Click Tracking Windows Applications
Asked Answered
K

1

7

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?

Know answered 30/3, 2012 at 20:44 Comment(0)
S
3

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.

Swanky answered 2/4, 2012 at 20:52 Comment(2)
I've actually been looking into alternatives like MSAA and the UI Automation libraries. The Windows SDK v7.1 has a bunch of tools that show what's possible, and it seems to be more or less what I need.Know
@RMD: I should have thought of that. The accessibility stuff is often good for the types of things people turn to hooks.Swanky

© 2022 - 2024 — McMap. All rights reserved.