MyQ2004
asked on
Monitor PC activity
I am developing an application that monitor activities on XP/win2k machine. It is a simple application that calculates total idle time and active time and produces a report daily. The machine is considered idle if there's no keyboard or mouse movement.
What's the best way to do the above ? I am trying a method that detects keyboard and mouse activities, Â basically capturing windows event such as WM_KEYUP, WM_LBUTTONDBLCLK, etc.. My question is how reliable this method is ? I am using SetWindowsHookEx API call to intercept the windows messages.
Thanks.
What's the best way to do the above ? I am trying a method that detects keyboard and mouse activities, Â basically capturing windows event such as WM_KEYUP, WM_LBUTTONDBLCLK, etc.. My question is how reliable this method is ? I am using SetWindowsHookEx API call to intercept the windows messages.
Thanks.
Capturing such activities from all applications is always made with hooks. So you went the right way. Now the only thing you need to refine is what events you want to capture. Maybe you will need WM_KEYDOWN, WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MOUSEWHEEL because with the events you showed, you will only capture double clicks from the left button, nothing from the right button, nothing from the mouse wheel.
this example may help you for a start
http://www.codeproject.com/csharp/globalhook.asp
http://www.codeproject.com/csharp/globalhook.asp
You might be able to do a lot of what you want with built-in performance counters:
http://www.microsoft.com/windows2000/techinfo/reskit/en-us/default.asp?url=/windows2000/techinfo/reskit/en-us/counters/counters1_qrgg.asp
http://www.microsoft.com/windows2000/techinfo/reskit/en-us/default.asp?url=/windows2000/techinfo/reskit/en-us/counters/counters1_qrgg.asp
ASKER
How do I use performance data to check if the user actually used the keyboard or mouse ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to help
Thanx for accepting
Thanx for accepting