Is there a tool to gather Win32 application usage statistics? [closed]

荒凉一梦 提交于 2019-12-03 07:50:49

问题


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.


回答1:


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.




回答2:


I assume you are talking about the windows performance counters

Have a look at this link

Use the Windows System Monitor (SYSMON) to see the result

have a look at this link

There is also Prof's Performance Monitoring Components for delphi




回答3:


Do you need some coverage analysis tool?



来源:https://stackoverflow.com/questions/1115048/is-there-a-tool-to-gather-win32-application-usage-statistics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!