home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / zkuste / delphi / kompon / d56 / MSYSINFO.ZIP / D5 / MSystemInfo.pas < prev   
Pascal/Delphi Source File  |  2002-01-04  |  3KB  |  117 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       MiTeC System Information Component              }
  5. {           version 7.0 for Delphi 5,6                  }
  6. {                                                       }
  7. {       Copyright ⌐ 1997,2002 Michal Mutl               }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. {$INCLUDE MITEC_DEF.INC}
  12.  
  13. unit MSystemInfo;
  14.  
  15. interface
  16.  
  17. uses
  18.   MiTeC_PerfLibNT,
  19.   MiTeC_PerfLib9x,
  20.   MiTeC_EventLogNT,
  21.   MiTeC_Shares,
  22.   MiTeC_AccountsNT,
  23.   MiTeC_JobsNT,
  24.   MiTeC_WkstaNT,
  25.   MiTeC_ServerNT,
  26.   MiTeC_SvrAPI,
  27.   MiTeC_AdvAPI,
  28.   MiTeC_PSAPI,
  29.   MiTeC_EnumsNT,
  30.   MiTeC_Enums9x,
  31.   MiTeC_WnASPI32,
  32.   MiTeC_NetAPI32,
  33.   MiTeC_CtrlRtns,
  34.   MiTeC_Routines,
  35.   MiTeC_ToolHelp32,
  36.  
  37.   MSI_Processes,
  38.   MSI_Console,
  39.  
  40.   Classes,
  41.   {$IFDEF D6PLUS}
  42.   DesignIntf, DesignEditors
  43.   {$ELSE}
  44.   DsgnIntf
  45.   {$ENDIF}
  46.   ;
  47.  
  48. type
  49.   TMSI_PropertyEditor = class(TStringProperty)
  50.   public
  51.     function GetAttributes: TPropertyAttributes; override;
  52.     procedure Edit; override;
  53.   end;
  54.  
  55.   TMSI_ComponentEditor = class(TComponentEditor)
  56.   public
  57.     function GetVerbCount: Integer; override;
  58.     function GetVerb(Index: Integer): String; override;
  59.     procedure ExecuteVerb(Index: Integer); override;
  60.     procedure Edit; override;
  61.   end;
  62.  
  63. procedure Register;
  64.  
  65. implementation
  66.  
  67. uses MSI_GUI, MSI_CPUUsage, Forms;
  68.  
  69. procedure Register;
  70. begin
  71.   RegisterComponents('MiTeC',[TMCPUUsage]);
  72.   RegisterComponents('MiTeC',[TMSystemInfo]);
  73.   RegisterPropertyEditor(TypeInfo(string),TMSystemInfo,'About',TMSI_PropertyEditor);
  74.   RegisterComponentEditor(TMSystemInfo,TMSI_ComponentEditor);
  75. end;
  76.  
  77. { TMSI_ComponentEditor }
  78.  
  79. procedure TMSI_ComponentEditor.Edit;
  80. begin
  81.   TMSystemInfo(Self.Component).ShowModalOverviewWithAbout;
  82. end;
  83.  
  84. procedure TMSI_ComponentEditor.ExecuteVerb(Index: Integer);
  85. begin
  86.   if Index=0 then
  87.     Edit;
  88. end;
  89.  
  90. function TMSI_ComponentEditor.GetVerb(Index: Integer): String;
  91. begin
  92.   if Index=0 then
  93.     Result:='System Overview...'
  94.   else
  95.     Result:=inherited GetVerb(Index-1);
  96. end;
  97.  
  98. function TMSI_ComponentEditor.GetVerbCount: Integer;
  99. begin
  100.   Result:=inherited GetVerbCount+1;
  101. end;
  102.  
  103. { TMSI_PropertyEditor }
  104.  
  105. procedure TMSI_PropertyEditor.Edit;
  106. begin
  107.   TMSystemInfo(Self.GetComponent(0)).ShowModalOverviewWithAbout;
  108. end;
  109.  
  110. function TMSI_PropertyEditor.GetAttributes: TPropertyAttributes;
  111. begin
  112.   Result:=[paDialog, paReadOnly];
  113. end;
  114.  
  115. end.
  116.  
  117.