开发者

Usage frequency of windows application

I have a homepage need to count the usage frequency of Notepad or Calc application. Is there any Windows API that I can know the usage frequency开发者_如何转开发 of windows application?


No. But you can write a service that will check applications in memory and do appropriate calculations. Few links:

  • Windows Services Programming
  • Simple Windows Service Sample

Also, shell variant from bua is quite ready solution. You just need some parsing and updating the counter (not necessary in the database).


I don't know about one, but You could quite easily achieve that by:

ex: using

cmd.exe -> tasklist

apply each 10 sec. (that would not load the CPU) - one good solution is to use python scheduler.

import sched, time
from subprocess import *
s = sched.scheduler(time.time, time.sleep)
def get_task():
    f=open("log",'wt')
    p=Popen("tasklist",stdout=f)
    p.terminate()
    p.close()

def analise_logs():
    # do some analise here

def print_some_times():
    while(1):
        print time.time()
        s.enter(5, 1, get_tasks, ())
        analise_logs()
        s.run()

do some awk (if you have cygwin), or powershell awk like processing on that file.

Count processes which interest you. Write result to another file with updated infos.


Take a look at my answer to How Do I Stop An Application From Opening and use the same technique. In essence when the application is launched your program is run and you can log any information that you require and then open the app.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜