Click here to Skip to main content
15,908,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Now I get the list of running applications using c# windows App.


How to get worked Hours for application using c#.net? For Example I have worked 8 hours a day then 4hours for Visual studio and 4 hours for Excelsheet. I want to get these information in C#.net windows applications

Please let me know if anybody knows.


Thanks.
Posted
Updated 20-Jan-15 18:52pm
v3
Comments
Sinisa Hajnal 21-Jan-15 2:08am    
Somebody always knows. But your question should offer sample data and expected output. Also, repository techonology. It's not the same if you have XML file as repository and SQL Server or DB2.

Is there something unclear with my solution?
24983 22-Jan-15 2:27am    
Hi please find below example, Can we get it from C# windows application and as well as run on background process.
I need output below,
Application WorkingHours
-----------------------------------
Visual studio ----- 2
notepad -------- 2
MS Sqlserver--------- 4

1 solution

Have a service or small always active program that will poll the processes and write the start times into the storage (database / file / whatever).

When, in the next poll the process is not found, you write END time.

Finally, you select from the storage and calculate time diff and sumarize it over the day (so you could have two excel starts and ends for two hours each)

Refinements: have a lookup table with the list of time tracked applications so that only those in the list are tracked.

Refinement2: use windows system hooks, there is a good article on CP somewhere.


If this helps please take time to accept the solution. Thank you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900