有没有收集Win32应用程序使用统计信息的工具? [英] Is there a tool to gather Win32 application usage statistics?

查看:189
本文介绍了有没有收集Win32应用程序使用统计信息的工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有可以做到这一点的工具?就像一个网站和基本的原因一样?



更新---
我的意思是收集关于我正在写的应用程序的统计信息
我需要知道最常使用哪些选项,何时,时间等。

解决方案

我已经在过去。



有两种方法可以想到这样做。



使用操作: / strong>



当使用动作时,通过将代码放在TActionList.OnExecute处理程序中,可以很容易地遵循UI的使用。此事件在执行个别操作之前触发,允许您跟踪发生了什么和何时。



例如:

  procedure TForm1.ActionList1Execute(Action:TBasicAction; var Handled:Boolean); 
begin
WriteToLog(TAction(TBasicAction).Caption);
结束

没有操作:



如果你不使用Action,它会变得有点困难,但不是不可能。创建必须使用TMenuItem后代创建一个新的单元,其中包含记录代码。确保将您的新设备放在使用该单元的使用条款中的MENU单元之后。新的后代必须被称为TMenuItem以使其工作。因为你本质上重新引入了同一个类,而且具有扩展的功能。



这是一个快速的单元,我一起投掷显示一个非常简单的例子。

  unit MenuItemLogger; 

界面

使用菜单;

键入
TMenuItem = class(Menus.TMenuItem)
public
程序单击;覆盖
结束

实现

使用窗口;

{TMenuItem}

程序TMenuItem.Click;
begin
outputdebugstring(PWideChar(self.Caption));
继承;
结束

结束。

要使用上述单位,将其作为任何表单/ DataModule的uses子句中的最后一个单元,菜单(TMainMenu或TPopupMenu)。如果你不想跟踪一个特定的单位不包括它。

 使用
Windows, SysUtils,变体,类,图形,控件,表单,
对话框,ActnList,菜单,MenuItemLogger;

这两种方法很简单,而他们的工作,他们可能不是最好的解决方案。


Is there any tool that can do this? Just like a website and for the same basic reasons?

UPDATE --- I mean collecting statistics info about an application that I am writing I need to know what options are used most, when, times, etc.

解决方案

I've done something like this in the past.

There are two ways that I can think of to do this.

With Actions:

When using actions it's very easy to follow the UI usage by placing code in the TActionList.OnExecute handler. This event fires off before the individual action executes which allows for you to trace what has happened and when.

For Example:

procedure TForm1.ActionList1Execute(Action: TBasicAction; var Handled: Boolean);
begin
   WriteToLog(TAction(TBasicAction).Caption);
end;

Without Actions:

If your not using Actions it becomes a little more difficult but not impossible. You create have to create a new unit with a TMenuItem descendant with your logging code in it. Make sure to place your new unit after the MENU unit in the uses clause in every unit that makes use of it. The new descendant has to be called TMenuItem for this to work. Since your essentially reintroducing the same class but with extended functionality.

Here is a quick unit I threw together showing a very simple example.

unit MenuItemLogger;

interface

uses Menus;

Type
  TMenuItem = class(Menus.TMenuItem)
  public
    procedure Click; override;
  end;

implementation

uses windows;

{ TMenuItem }

procedure TMenuItem.Click;
begin
  outputdebugstring(PWideChar(self.Caption));
  inherited;
end;

end.

To use the above unit place it as the last unit in the uses clause of any form/DataModule with menus (TMainMenu or TPopupMenu) that you want to trace. If you don't want to trace a particular unit don't include it.

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActnList, Menus, MenuItemLogger;

These two methods are simple and while they do work they probably are not the best solutions.

这篇关于有没有收集Win32应用程序使用统计信息的工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆