Monitor PC activity

Posted on 2004-09-16
Last Modified: 2010-04-15
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.

Question by:MyQ2004
LVL 20

Expert Comment

ID: 12082051
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.
LVL 18

Expert Comment

ID: 12082091
this example may help you for a start

Expert Comment

ID: 12084235
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails


Author Comment

ID: 12246651
How do I use performance data to check if the user actually used the keyboard or mouse ?
LVL 18

Accepted Solution

armoghan earned 125 total points
ID: 12247508
LVL 18

Expert Comment

ID: 12247556
LVL 18

Expert Comment

ID: 12295394
Glad to help
Thanx for accepting

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now