⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 details.pas

📁 一个很不错的系统信息控件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
      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('-');
    end;
    with CntList.Items.Add do begin
      Caption:='Read Transfer Count';
      SubItems.Add(Format('%d',[FPI.IOCounters.ReadTransferCount.QuadPart]));
      SubItems.Add('-');
    end;
    with CntList.Items.Add do begin
      Caption:='Write Transfer Count';
      SubItems.Add(Format('%d',[FPI.IOCounters.WriteTransferCount.QuadPart]));
      SubItems.Add('-');
    end;
    with CntList.Items.Add do begin
      Caption:='Other Transfer Count';
      SubItems.Add(Format('%d',[FPI.IOCounters.OtherTransferCount.QuadPart]));
      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:='Virtual Memory Counters';
      ImageIndex:=-3;
    end;
    with CntList.Items.Add do begin
      Caption:='Page Fault Count';
      SubItems.Add(Format('%d',[FPI.VMCounters.PageFaultCount]));
      SubItems.Add('-');
    end;
    with CntList.Items.Add do begin
      Caption:='Virtual Size';
      SubItems.Add(Format('%d B',[FPI.VMCounters.VirtualSize]));
      SubItems.Add(Format('%d B',[FPI.VMCounters.PeakVirtualSize]));
    end;
    with CntList.Items.Add do begin
      Caption:='Working Set Size';
      SubItems.Add(Format('%d B',[FPI.VMCounters.WorkingSetSize]));
      SubItems.Add(Format('%d B',[FPI.VMCounters.PeakWorkingSetSize]));
    end;
    with CntList.Items.Add do begin
      Caption:='Quota Peak Paged Pool Usage';
      SubItems.Add(Format('%d B',[FPI.VMCounters.QuotaPagedPoolUsage]));
      SubItems.Add(Format('%d B',[FPI.VMCounters.QuotaPeakPagedPoolUsage]));
    end;
    with CntList.Items.Add do begin
      Caption:='Quota Peak Non Paged Pool Usage';
      SubItems.Add(Format('%d B',[FPI.VMCounters.QuotaNonPagedPoolUsage]));
      SubItems.Add(Format('%d B',[FPI.VMCounters.QuotaPeakNonPagedPoolUsage]));
    end;
    with CntList.Items.Add do begin
      Caption:='Pagefile Usage';
      SubItems.Add(Format('%d B',[FPI.VMCounters.PagefileUsage]));
      SubItems.Add(Format('%d B',[FPI.VMCounters.PeakPagefileUsage]));
    end;
  end;

  HList.Items.Clear;
  for i:=0 to FPL.HandleCount-1 do
    if FPL.Handles[i].PID=FPI.PID then
      with HList.Items.Add do begin
        Caption:=Format('0x%x',[FPL.Handles[i].Handle]);
        SubItems.Add(cSystemHandleType[TSystemHandleType(FPL.Handles[i].Typ)]);
        SubItems.Add(Format('0x%x',[FPL.Handles[i].Access]));
        SubItems.Add(FPL.Handles[i].Name);
      end;
  TabSheet6.Caption:=Format(' Handles (%d) ',[HList.Items.Count]);


  WinTree.Items.Clear;
  for i:=0 to FPL.WindowCount-1 do begin
    if FPL.Windows[i].Process<>FPI.PID then
      Continue;
    r:=nil;
    for j:=0 to WinTree.Items.Count-1 do
      if PInteger(WinTree.Items[j].Data)^=FPL.Windows[i].ParentWin then begin
        r:=WinTree.Items[j];
        Break;
      end;
    n:=WinTree.Items.AddChild(r,Format('(0x%x) "%s": %s',[FPL.Windows[i].Handle,FPL.Windows[i].Text,FPL.Windows[i].ClassName]));
    n.ImageIndex:=Integer(FPL.Windows[i].Visible);
    n.Data:=Allocmem(SizeOf(Integer));
    PInteger(n.Data)^:=FPL.Windows[i].Handle;
  end;
  if WinTree.Items.Count>0 then begin
    WinTree.FullExpand;
    WinTree.Items[0].MakeVisible;
  end;
  TabSheet7.Caption:=Format(' Windows (%d) ',[WinTree.Items.Count]);
end;

procedure Tdlg_Details.ListAdvancedCustomDrawItem(
  Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
  Stage: TCustomDrawStage; var DefaultDraw: Boolean);
begin
  if ListView_SortColumn=0 then
    Sender.Canvas.Brush.Color:=clInfoBk
  else
    Sender.Canvas.Brush.Color:=clWhite
end;

procedure Tdlg_Details.ListAdvancedCustomDrawSubItem(
  Sender: TCustomListView; Item: TListItem; SubItem: Integer;
  State: TCustomDrawState; Stage: TCustomDrawStage;
  var DefaultDraw: Boolean);
begin
  if ListView_SortColumn=SubItem then
    Sender.Canvas.Brush.Color:=clInfoBk
  else
    Sender.Canvas.Brush.Color:=clWhite
end;

procedure Tdlg_Details.ListColumnClick(Sender: TObject;
  Column: TListColumn);
begin
  TListView(Sender).SortType:=stNone;
  if Column.Index<>ListView_SortColumn then begin
    ListView_SortColumn:=Column.Index;
    ListView_SortDescending:=False;
  end else
    ListView_SortDescending:=not ListView_SortDescending;
  TListView(Sender).SortType:=stText;
end;

procedure Tdlg_Details.ListCompare(Sender: TObject; Item1,
  Item2: TListItem; Data: Integer; var Compare: Integer);
begin
  Compare:=ListView_CustomSort(Item1,Item2,ListView_SortColumn);
  if ListView_SortDescending then
    Compare:=-Compare;
end;

procedure Tdlg_Details.GenListAdvancedCustomDrawItem(Sender: TCustomListView;
  Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
  var DefaultDraw: Boolean);
begin
  DefaultDraw:=True;
  with TListView(Sender) do begin
    Canvas.Font.Style:=[];
    if Item.ImageIndex=-3 then
      Canvas.Font.Style:=[fsBold];
    Canvas.Font.Color:=clBlack;
    if cdsHot in State then 
      Canvas.Font.Style:=Canvas.Font.Style+[fsUnderline]
    else
      Canvas.Font.Style:=Canvas.Font.Style-[fsUnderline];
    if Item.ImageIndex=-2 then
      ListView_DrawLine(Sender,Item,State,DefaultDraw,clGray);
  end;
end;

procedure Tdlg_Details.GenListAdvancedCustomDrawSubItem(
  Sender: TCustomListView; Item: TListItem; SubItem: Integer;
  State: TCustomDrawState; Stage: TCustomDrawStage;
  var DefaultDraw: Boolean);
begin
  with TListView(Sender) do begin
    Canvas.Font.Style:=[];
    if Item.ImageIndex=-3 then
      Canvas.Font.Style:=[fsBold];
    Canvas.Font.Color:=clBlack;
    if Item.ImageIndex=-4 then
      ListView_DrawCheckBox(Sender,Item,SubItem,State,DefaultDraw,'1')
    else
      Canvas.Brush.Color:=Color;
    if cdsHot in State then
      Canvas.Font.Style:=Canvas.Font.Style+[fsUnderline]
    else
      Canvas.Font.Style:=Canvas.Font.Style-[fsUnderline];
  end;
end;

procedure Tdlg_Details.GenListDblClick(Sender: TObject);
var
  idx: Integer;
begin
  idx:=FPL.FindProcess(FPL.Processes[FIndex].ParentPID);
  if idx>=0 then begin
    FIndex:=idx;
    RefreshData;
  end;
end;

procedure Tdlg_Details.CPListDblClick(Sender: TObject);
var
  idx: Integer;
begin
  if Assigned(CPList.Selected) then begin
    try
      idx:=FPL.FindProcess(StrToInt(CPList.Selected.Caption));
    except
      idx:=FPL.FindProcess(StrToInt('$'+CPList.Selected.Caption));
    end;
    if idx>=0 then begin
      FIndex:=idx;
      RefreshData;
      pc.ActivePage:=TabSheet1;
    end;
  end;
end;

procedure Tdlg_Details.ModListDblClick(Sender: TObject);
begin
  if Assigned(ModList.Selected) then
    ShellPropDlg(Handle,ModList.Selected.SubItems[0]);
end;

procedure Tdlg_Details.Button4Click(Sender: TObject);
begin
  if FPL.Processes[FIndex].PID>9 then
    ShellPropDlg(Handle,FPL.Processes[FIndex].ImageName);
end;

procedure Tdlg_Details.bRefreshClick(Sender: TObject);
var
  PID: DWORD;
  idx: Integer;
begin
  Screen.Cursor:=crHourglass;
  try
    PID:=FPL.Processes[FIndex].PID;
    FPL.GetInfo;
    idx:=FPL.FindProcess(PID);
    if idx>=0 then begin
      FIndex:=idx;
      RefreshData;
    end else
      Close;
  finally
    Screen.Cursor:=crDefault;
  end;
end;

procedure Tdlg_Details.FormCreate(Sender: TObject);
begin
  pc.ActivePage:=TabSheet1;
end;

procedure Tdlg_Details.WinTreeDeletion(Sender: TObject; Node: TTreeNode);
begin
  Dispose(PInteger(Node.Data));
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -