How to calculate the total time a user spending on an application?

后端 未结 6 1038
Happy的楠姐
Happy的楠姐 2021-02-07 08:16

I want to create an application that able to calculate the total time the user (i.e. myself) spent on a particular application, for example Firefox. And this application should

6条回答
  •  一向
    一向 (楼主)
    2021-02-07 08:30

    There are many tools to do this like RescueTime etc... but you could use some .net code to knock up an approximation quite quickly.

    You would need to poll the list of processes at some given interval,

    psList = Process.GetProcesses() 
    

    You could use the starttime property and the main window title to get information about each process. I am not sure how to tell which one is active or not.

提交回复
热议问题