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

📄 viewer.pas

📁 一个很不错的系统信息控件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
          SubItems.Add(CodeName);
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=rsRevision;
          SubItems.Add(Revision);
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=rsTechnology;
          SubItems.Add(Technology);
          ImageIndex:=-1;
        end;
        if Features.Standard1.FeaturesByFlag[SFS_PSN].Available then
          with Add do begin
            Caption:=rsSerial;
            SubItems.Add(SerialNumber);
            ImageIndex:=-1;
          end;
        if CPUCount>1 then begin
          with Add do begin
            Caption:=Format('%s',[rsAPIC]);
            SubItems.Add(Format('%d',[APICID]));
            ImageIndex:=-1;
          end;
          with Add do begin
            Caption:=Format('%s',[rsPhysID]);
            SubItems.Add(Format('%d',[PhysicalID]));
            ImageIndex:=-1;
          end;
          with Add do begin
            Caption:=Format('%s',[rsLogID]);
            SubItems.Add(Format('%d',[LogicalID]));
            ImageIndex:=-1;
          end;
        end;
      end;
    finally
      EndUpdate;
    end;
  end;
end;

procedure Tmdi_msi_Viewer.ListAdvancedCustomDrawSubItem(
  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:=clWhite;
    if cdsHot in State then
      Canvas.Font.Style:=Canvas.Font.Style+[fsUnderline]
    else
      Canvas.Font.Style:=Canvas.Font.Style-[fsUnderline];
  end;
end;

procedure Tmdi_msi_Viewer.DisplaySMBIOSMemoryModuleDetail;
begin
  with List, Items do begin
    BeginUpdate;
    try
      Clear;
      with MSIC.Machine.SMBIOS do begin
        with Add do begin
          Caption:=Format('%s %s',[rsSocket,rsDesignation]);
          SubItems.Add(MemoryModule[AIndex].Socket);
          ImageIndex:=-3;
        end;
        with Add do begin
          Caption:=rsType;
          SubItems.Add(GetMemoryTypeStr(MemoryModule[AIndex].Types));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=rsSize;
          SubItems.Add(Format('%d MB',[MemoryModule[AIndex].Size]));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=rsSpeed;
          SubItems.Add(Format('%d ns',[MemoryModule[AIndex].Speed]));
          ImageIndex:=-1;
        end;
      end;
    finally
      EndUpdate;
    end;
  end;
end;

procedure Tmdi_msi_Viewer.DisplayMemoryInfo;
begin
  with List, Items do begin
    BeginUpdate;
    try
      Clear;
      with MSIC.Memory do begin
        with Add do begin
          Caption:=rsAppAddrRange;
          SubItems.Add(Format('%8.8xh - %8.8xh',[MinAppAddress,MaxAppAddress]));
          ImageIndex:=-3;
        end;
        with Add do begin
          Caption:=rsAllocationGranularity;
          SubItems.Add(FormatFloat('#,#0 B',AllocGranularity));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=rsPageSize;
          SubItems.Add(FormatFloat('#,#0 B',PageSize));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:='';
          ImageIndex:=-2;
        end;
        with Add do begin
          Caption:=rsPhysTotal;
          SubItems.Add(FormatFloat('#,#0 B',PhysicalTotal)+Format(' (%d MB)',[(PhysicalTotal div 1024) div 1024]));
          ImageIndex:=-3;
        end;
        with Add do begin
          Caption:=rsPhysFree;
          SubItems.Add(FormatFloat('#,#0 B',PhysicalFree)+Format(' (%d MB)',[(PhysicalFree div 1024) div 1024]));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=rsPageFileTotal;
          SubItems.Add(FormatFloat('#,#0 B',PageFileTotal)+Format(' (%d MB)',[(PageFileTotal div 1024) div 1024]));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=rsPageFileFree;
          SubItems.Add(FormatFloat('#,#0 B',PageFileFree)+Format(' (%d MB)',[(PageFileFree div 1024) div 1024]));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=rsVirtTotal;
          SubItems.Add(FormatFloat('#,#0 B',VirtualTotal)+Format(' (%d MB)',[(VirtualTotal div 1024) div 1024]));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=rsVirtFree;
          SubItems.Add(FormatFloat('#,#0 B',VirtualFree)+Format(' (%d MB)',[(VirtualFree div 1024) div 1024]));
          ImageIndex:=-1;
        end;
      end;
    finally
      EndUpdate;
    end;
  end;
end;

procedure Tmdi_msi_Viewer.DisplayMotherboardInfo;
var
  s,v: string;
  k: TSMBIOS_SlotType;
  i,c: Integer;
begin
  with List, Items do begin
    BeginUpdate;
    try
      Clear;
      with MSIC.Machine.SMBIOS do begin
        with Add do begin
          Caption:=Format('%s %s',[rsSystem,rsModel]);
          SubItems.Add(SystemModel);
          ImageIndex:=-3;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsSystem,rsManufacturer]);
          SubItems.Add(SystemManufacturer);
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:='';
          ImageIndex:=-2;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsMotherboard,rsModel]);
          SubItems.Add(MainboardModel);
          ImageIndex:=-3;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsMotherboard,rsManufacturer]);
          SubItems.Add(MainboardManufacturer);
          ImageIndex:=-1;
        end;
        with Add do begin
          v:='';
          for k:=Low(TSMBIOS_SlotType) to High(TSMBIOS_SlotType) do begin
            c:=0;
            for i:=0 to SystemSlotCount-1 do
              if SystemSlot[i].Typ=k then begin
                Inc(c);
                s:=SlotTypes[SystemSlot[i].Typ];
             end;
           if c>0 then
             v:=v+Format('%dx%s, ',[c,s]);
          end;
          SetLength(v,Length(v)-2);
          Caption:=Format('%s %s',[rsSystem,rsSlots]);
          SubItems.Add(v);
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:='';
          ImageIndex:=-2;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsBIOS,rsVendor]);
          SubItems.Add(BIOSVendor);
          ImageIndex:=-3;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsBIOS,rsVersion]);
          SubItems.Add(BIOSVersion);
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsBIOS,rsDate]);
          SubItems.Add(BIOSDate);
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsBIOS,rsSize]);
          SubItems.Add(Format('%d KB',[BIOSSize]));
          ImageIndex:=-1;
        end;
      end;
    finally
      EndUpdate;
    end;
  end;
end;

procedure Tmdi_msi_Viewer.DisplayDeviceDetail(AIndex: Integer);
var
  DR: TDeviceResources;
  i: Integer;
  v,d: string;
begin
  with List, Items do begin
    BeginUpdate;
    try
      Clear;
      with MSIC.Devices do begin
        with Add do begin
          Caption:=Format('%s %s',[rsDevice,rsName]);
          SubItems.Add(Devices[AIndex].Name);
          ImageIndex:=-3;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsDriver,rsProvider]);
          SubItems.Add(Devices[AIndex].DriverProvider);
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsDriver,rsVersion]);
          SubItems.Add(Devices[AIndex].DriverVersion);
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsDriver,rsDate]);
          SubItems.Add(Devices[AIndex].DriverDate);
          ImageIndex:=-1;
        end;
        if {$IFDEF SIS}StorageInfo.OSPlatform{$ELSE}Win32Platform{$ENDIF}=VER_PLATFORM_WIN32_NT then begin
          with Add do begin
            Caption:='';
            ImageIndex:=-2;
          end;
          with Add do begin
            Caption:=Format('%s %s',[rsPCI,rsNumber]);
            SubItems.Add(Format('%d',[Devices[AIndex].PCINumber]));
            ImageIndex:=-1;
          end;
          with Add do begin
            Caption:=Format('%s %s',[rsDevice,rsNumber]);
            SubItems.Add(Format('%d',[Devices[AIndex].DeviceNumber]));
            ImageIndex:=-1;
          end;
          with Add do begin
            Caption:=Format('%s %s',[rsFunction,rsNumber]);
            SubItems.Add(Format('%d',[Devices[AIndex].FunctionNumber]));
            ImageIndex:=-1;
          end;
        end;
        with Add do begin
          Caption:='';
          ImageIndex:=-2;
        end;
        ExpandHID(Devices[AIndex].VendorID,Devices[AIndex].DeviceID,v,d);
        with Add do begin
          Caption:=Format('%s %s',[rsVendor,rsID]);
          SubItems.Add(Format('%4.4x (%s)',[Devices[AIndex].VendorID,v]));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsDevice,rsID]);
          SubItems.Add(Format('%4.4x (%s)',[Devices[AIndex].DeviceID,d]));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=Format('%s',[rsSubSystem]);
          SubItems.Add(Format('%8.8x',[Devices[AIndex].SubSysID]));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:=Format('%s',[rsRevision]);
          SubItems.Add(Format('%2.2x',[Devices[AIndex].Revision]));
          ImageIndex:=-1;
        end;
        with Add do begin
          Caption:='';
          ImageIndex:=-2;
        end;
        if LiveData and (Devices[AIndex].ResourceListKey<>'') then begin
          GetDeviceResources(Devices[AIndex],DR);
          for i:=0 to High(DR.Resources) do
            case DR.Resources[i].Typ of
              CmResourceTypePort: with Add do begin
                Caption:=rsPortRange;
                SubItems.Add(Format('0x%8.8x - 0x%8.8x',[DR.Resources[i].Port.Start.QuadPart,
                                                         DR.Resources[i].Port.Start.QuadPart+DR.Resources[i].Port.Length-1]));
                ImageIndex:=-1;
              end;
              CmResourceTypeInterrupt: with Add do begin
                Caption:=rsIRQ;
                SubItems.Add(Format('IRQ%d',[DR.Resources[i].Interrupt.Vector]));
                ImageIndex:=-1;
              end;
              CmResourceTypeMemory: with Add do begin
                Caption:=rsMemoryRange;
                SubItems.Add(Format('0x%8.8x - 0x%8.8x',[DR.Resources[i].Memory.Start.QuadPart,
                                                         DR.Resources[i].Memory.Start.QuadPart-DR.Resources[i].Memory.Length]));
                ImageIndex:=-1;
              end;
              CmResourceTypeDma: with Add do begin
                Caption:=rsDMA;
                SubItems.Add(Format('%d',[DR.Resources[i].DMA.Channel]));
                ImageIndex:=-1;
              end;
          end;
        end;
      end;
    finally
      EndUpdate;
    end;
  end;
end;

procedure Tmdi_msi_Viewer.DisplayDeviceInfo;
begin
  with List, Items do begin
    BeginUpdate;
    try
      Clear;
      with Add do begin
        Caption:=Format('%s %s',[rsDevice,rsCount]);
        SubItems.Add(Format('%d',[Tree.Selected.Count]));
        ImageIndex:=-3;
      end;
    finally
      EndUpdate;
    end;
  end;
end;

procedure Tmdi_msi_Viewer.DisplaySMBIOSInfo;
var
  i: Integer;
begin
  with List, Items do begin
    BeginUpdate;
    try
      Clear;
      with MSIC.Machine.SMBIOS do begin
        with Add do begin
          Caption:=rsVersion;
          SubItems.Add(Version);
          ImageIndex:=-3;
        end;
        with Add do begin
          Caption:='';
          ImageIndex:=-2;
        end;
        with Add do begin
          Caption:=Format('%s %s',[rsTable,rsCount]);
          SubItems.Add(Format('%d',[Length(StructTables)]));
          ImageIndex:=-3;
        end;
        for i:=0 to High(StructTables) do

⌨️ 快捷键说明

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