Link to home
Start Free TrialLog in
Avatar of MyQ2004
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.
Avatar of TheAvenger
TheAvenger
Flag of Switzerland image

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
Avatar of jimwasson
jimwasson

Avatar of MyQ2004

ASKER

How do I use performance data to check if the user actually used the keyboard or mouse ?
ASKER CERTIFIED SOLUTION
Avatar of armoghan
armoghan
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glad to help
Thanx for accepting