?? prcdetails.pas
字號(hào):
unit PrcDetails;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, MSI_Processes, ImgList;
type
Tdlg_PrcDetails = class(TForm)
Bevel1: TBevel;
bClose: TButton;
pc: TPageControl;
TabSheet2: TTabSheet;
ModList: TListView;
TabSheet1: TTabSheet;
GenList: TListView;
imgIcon: TImage;
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;
eName: TEdit;
TabSheet8: TTabSheet;
SecList: TListView;
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);
procedure cmWinDetails(Sender: TObject);
private
FPL: TMiTeC_ProcessList;
FIndex: DWORD;
public
procedure RefreshData;
end;
procedure ShowPrcDetails(var PL: TMiTeC_ProcessList; Index: DWORD);
var
dlg_PrcDetails: Tdlg_PrcDetails;
implementation
uses
MiTeC_CtrlRtns, MiTeC_Datetime, MiTeC_Routines, MiTeC_Dialogs, MiTeC_Native, WinDetails;
{$R *.dfm}
procedure ShowPrcDetails;
begin
with Tdlg_PrcDetails.Create(Application.Mainform) do
try
FPL:=PL;
FIndex:=Index;
RefreshData;
ShowModal;
PL:=FPL;
finally
Free;
end;
end;
procedure Tdlg_PrcDetails.RefreshData;
var
i,j: Integer;
FPI: TProcessInfo;
r,n: TTreeNode;
VersionInfo: TVersionInfo;
begin
TabSheet4.TabVisible:=Win32Platform=VER_PLATFORM_WIN32_NT;
TabSheet6.TabVisible:=Win32Platform=VER_PLATFORM_WIN32_NT;
TabSheet8.TabVisible:=Win32Platform=VER_PLATFORM_WIN32_NT;
FPI:=FPL.Processes[FIndex];
eName.Text:=FPI.Name;
if FileExists(FPI.ImageName) then
imgIcon.Picture.Icon.Handle:=GetFileIcon(FPI.ImageName);
GetFileVerInfo(FPI.ImageName,VersionInfo);
GenList.Items.Clear;
with GenList.Items.Add do begin
Caption:='Description';
SubItems.Add(VersionInfo.Description);
ImageIndex:=-3;
end;
with GenList.Items.Add do begin
Caption:='Version';
SubItems.Add(VersionInfo.Version);
end;
with GenList.Items.Add do begin
Caption:='Product Name';
SubItems.Add(VersionInfo.ProductName);
end;
with GenList.Items.Add do begin
Caption:='Company Name';
SubItems.Add(VersionInfo.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:='Command line';
SubItems.Add(GetProcessCommandLine(FPI.PID));
end;
with GenList.Items.Add do begin
Caption:='';
ImageIndex:=-2;
end;
if Win32Platform=VER_PLATFORM_WIN32_NT then
with GenList.Items.Add do begin
Caption:='User Name';
SubItems.Add(FPI.UserName);
ImageIndex:=-3;
end;
with GenList.Items.Add do begin
Caption:='Priority';
SubItems.Add(Format('%d',[FPI.Priority]));
if Win32Platform=VER_PLATFORM_WIN32_NT then
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[0].Width:=80;
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
if Win32Platform=VER_PLATFORM_WIN32_NT then
Caption:=Format('%d',[FPI.Threads[i].ClientID.UniqueThread])
else
Caption:=Format('0x%x',[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:='I/O Counters';
ImageIndex:=-3;
end;
with CntList.Items.Add do begin
Caption:='Read Operation Count';
SubItems.Add(Format('%d',[FPI.IOCounters.ReadOperationCount.QuadPart]));
SubItems.Add('-');
end;
with CntList.Items.Add do begin
Caption:='Write Operation Count';
SubItems.Add(Format('%d',[FPI.IOCounters.WriteOperationCount.QuadPart]));
SubItems.Add('-');
end;
with CntList.Items.Add do begin
Caption:='Other Operation Count';
SubItems.Add(Format('%d',[FPI.IOCounters.OtherOperationCount.QuadPart]));
SubItems.Add('-');
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -