I would like to develop an application (that runs at all times in the background I guess) to track the usage of applications (msword, excel, powerpoint, *.exe, etc.).
I can handle posting the data to a database but don’t exactly know where to start with monitoring running applications (when they start, when they stop). Anyone have any clues?
You can periodically poll a list of the running processes using
System.Diagnostics.Process.GetProcesses().This following code outputs information about starting and exiting processes. Exiting system processes won’t be recognized.
You probably can simply ignore system processes that don’t let you read the HasExited property.
Edit
Here’s a .net 2.0 version:
Note that the code could be improved and only shows the concept.