?? details.pas
字號:
unit Details;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, MSI_Processes, ImgList;
type
Tdlg_Details = class(TForm)
Bevel1: TBevel;
bClose: TButton;
pc: TPageControl;
TabSheet2: TTabSheet;
ModList: TListView;
TabSheet1: TTabSheet;
GenList: TListView;
imgIcon: TImage;
lName: TLabel;
TabSheet3: TTabSheet;
CPList: TListView;
Button1: TButton;
Button2: TButton;
TabSheet4: TTabSheet;
CntList: TListView;
Button3: TButton;
Button4: TButton;
bRefresh: TButton;
TabSheet5: TTabSheet;
ThdList: TListView;
TabSheet6: TTabSheet;
HList: TListView;
TabSheet7: TTabSheet;
WinTree: TTreeView;
ImageList: TImageList;
Button5: TButton;
procedure ListAdvancedCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
procedure ListAdvancedCustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
Stage: TCustomDrawStage; var DefaultDraw: Boolean);
procedure ListColumnClick(Sender: TObject; Column: TListColumn);
procedure ListCompare(Sender: TObject; Item1, Item2: TListItem;
Data: Integer; var Compare: Integer);
procedure GenListAdvancedCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
procedure GenListAdvancedCustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
Stage: TCustomDrawStage; var DefaultDraw: Boolean);
procedure GenListDblClick(Sender: TObject);
procedure CPListDblClick(Sender: TObject);
procedure ModListDblClick(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure bRefreshClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure WinTreeDeletion(Sender: TObject; Node: TTreeNode);
private
FPL: TProcessList;
FIndex: DWORD;
public
procedure RefreshData;
end;
procedure ShowDetails(var PL: TProcessList; Index: DWORD);
var
dlg_Details: Tdlg_Details;
implementation
uses
MiTeC_CtrlRtns, MiTeC_Datetime, MiTeC_Routines, MiTeC_Dialogs, MiTeC_Native;
{$R *.dfm}
procedure ShowDetails;
begin
with Tdlg_Details.Create(Application.Mainform) do
try
FPL:=PL;
FIndex:=Index;
RefreshData;
ShowModal;
PL:=FPL;
finally
Free;
end;
end;
procedure Tdlg_Details.RefreshData;
var
i,j: Integer;
VI: TVersionInfo;
FPI: TProcessInfo;
r,n: TTreeNode;
begin
TabSheet4.TabVisible:=Win32Platform=VER_PLATFORM_WIN32_NT;
TabSheet6.TabVisible:=Win32Platform=VER_PLATFORM_WIN32_NT;
FPI:=FPL.Processes[FIndex];
lName.Caption:=FPI.Name;
if FileExists(FPI.ImageName) then
imgIcon.Picture.Icon.Handle:=GetFileIcon(FPI.ImageName);
GetFileVerInfo(FPI.ImageName,VI);
GenList.Items.Clear;
with GenList.Items.Add do begin
Caption:='Description';
SubItems.Add(VI.Description);
ImageIndex:=-3;
end;
with GenList.Items.Add do begin
Caption:='Version';
SubItems.Add(VI.Version);
end;
with GenList.Items.Add do begin
Caption:='Product Name';
SubItems.Add(VI.ProductName);
end;
with GenList.Items.Add do begin
Caption:='Company Name';
SubItems.Add(VI.CompanyName);
end;
with GenList.Items.Add do begin
Caption:='';
ImageIndex:=-2;
end;
with GenList.Items.Add do begin
Caption:='PID';
if Win32Platform=VER_PLATFORM_WIN32_NT then
SubItems.Add(Format('%d',[FPI.PID]))
else
SubItems.Add(Format('%x',[FPI.PID]));
ImageIndex:=-3;
end;
with GenList.Items.Add do begin
Caption:='Parent PID';
if Win32Platform=VER_PLATFORM_WIN32_NT then
SubItems.Add(Format('%d',[FPI.ParentPID]))
else
SubItems.Add(Format('%x',[FPI.ParentPID]));
end;
with GenList.Items.Add do begin
Caption:='Image name';
SubItems.Add(FPI.ImageName);
end;
with GenList.Items.Add do begin
Caption:='';
ImageIndex:=-2;
end;
with GenList.Items.Add do begin
Caption:='Priority';
SubItems.Add(Format('%d',[FPI.Priority]));
ImageIndex:=-3;
end;
with GenList.Items.Add do begin
Caption:='Thread Count';
SubItems.Add(Format('%d',[FPI.ThreadCount]));
end;
if Win32Platform<>VER_PLATFORM_WIN32_NT then begin
with GenList.Items.Add do begin
Caption:='Process Usage';
SubItems.Add(Format('%d',[FPI.Usage]));
end;
end else begin
with GenList.Items.Add do begin
Caption:='Handle Count';
SubItems.Add(Format('%d',[FPI.HandleCount]));
end;
end;
TabSheet2.Caption:=Format(' Modules (%d) ',[Length(FPI.Modules)]);
ModList.Items.Clear;
for i:=0 to High(FPI.Modules) do
with ModList.Items.Add do begin
Caption:=FPI.Modules[i].Name;
SubItems.Add(Format('%d',[FPI.Modules[i].ImageSize]));
SubItems.Add(Format('0x%x',[FPI.Modules[i].BaseAddress]));
SubItems.Add(Format('0x%x',[FPI.Modules[i].EntryPoint]));
SubItems.Add(FPI.Modules[i].ImageName);
end;
TabSheet5.Caption:=Format(' Threads (%d) ',[FPI.ThreadCount]);
ThdList.Items.Clear;
if Win32Platform<>VER_PLATFORM_WIN32_NT then begin
ThdList.Columns.Items[1].Width:=0;
ThdList.Columns.Items[4].Width:=0;
ThdList.Columns.Items[5].Width:=0;
ThdList.Columns.Items[6].Width:=0;
ThdList.Columns.Items[7].Width:=0;
end;
for i:=0 to High(FPI.Threads) do
with ThdList.Items.Add do begin
Caption:=Format('%d',[FPI.Threads[i].ClientID.UniqueThread]);
Subitems.Add(Format('0x%p',[FPI.Threads[i].StartAddress]));
Subitems.Add(Format('%d',[FPI.Threads[i].BasePriority]));
Subitems.Add(Format('%d',[FPI.Threads[i].Priority]));
if TThreadState(FPI.Threads[i].State)<>StateWait then
SubItems.Add(cThreadState[TThreadState(FPI.Threads[i].State)])
else
SubItems.Add(Format('%s:%s',[cThreadState[TThreadState(FPI.Threads[i].State)],cKWaitReason[TKWaitReason(FPI.Threads[i].WaitReason)]]));
Subitems.Add(Format('%d',[FPI.Threads[i].ContextSwitchCount]));
SubItems.Add(FormatSeconds(FPI.Threads[i].KernelTime.QuadPart/10000000,True,False,True));
SubItems.Add(FormatSeconds(FPI.Threads[i].UserTime.QuadPart/10000000,True,False,True));
end;
CPList.Items.Clear;
for i:=0 to FPL.ProcessCount-1 do
if FPL.Processes[i].ParentPID=FPI.PID then
with CPList.Items.Add do begin
if Win32Platform=VER_PLATFORM_WIN32_NT then
Caption:=Format('%d',[FPL.Processes[i].PID])
else
Caption:=Format('%x',[FPL.Processes[i].PID]);
SubItems.Add(FPL.Processes[i].Name);
end;
TabSheet3.Caption:=Format(' Child Procs(%d) ',[CPList.Items.Count]);
if Win32Platform=VER_PLATFORM_WIN32_NT then begin
CntList.Items.Clear;
with CntList.Items.Add do begin
Caption:='CPU Times';
ImageIndex:=-3;
end;
with CntList.Items.Add do begin
Caption:='Kernel Time';
SubItems.Add(FormatSeconds(FPI.KernelTime.QuadPart/10000000,True,False,True));
SubItems.Add('-');
end;
with CntList.Items.Add do begin
Caption:='User Time';
SubItems.Add(FormatSeconds(FPI.UserTime.QuadPart/10000000,True,False,True));
SubItems.Add('-');
end;
with CntList.Items.Add do begin
Caption:='Total Time';
SubItems.Add(FormatSeconds((FPI.UserTime.QuadPart+FPI.KernelTime.QuadPart)/10000000,True,False,True));
SubItems.Add('-');
end;
with CntList.Items.Add do begin
Caption:='';
ImageIndex:=-2;
end;
with CntList.Items.Add do begin
Caption:='';
end;
with CntList.Items.Add do begin
Caption:='I/O Counters';
ImageIndex:=-3;
end;
with CntList.Items.Add do begin
Caption:='Read Operation Count';
SubItems.Add(Format('%d',[FPI.IOCounters.ReadOperationCount.QuadPart]));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -