I use a desktop application that should record the names and times of programs that a user opens on a PC. This is a C # application (WPF) that starts when a user logs in and starts without a user interface. For programs such as Word or IE, it also captures which document or URL they are viewing.
I currently have a working solution as follows:
Install the Windows Hook for the mouse. When this event fires, I use p-Invoke for "GetForegroundWindow" and then use the window handle for "GetWindowThreadProcessId", and ProcessId can get a System.Diagnostics.Process object containing the name, start time and start of the argument list. I keep a history list, so I only write a tracking record if this process / dd descriptor combination has not been written before.
This solution works fine, but requires a mouse hook that can be removed by Windows without any notification or problematic ability to check if it is all connected. Not to mention that this implementation seems to be a hack.
If there is a simpler approach, consult with him.
Thanks.
source share