home *** CD-ROM | disk | FTP | other *** search
-
- {*******************************************************}
- { }
- { MiTeC System Information Component }
- { version 6.0 for Delphi 5,6 }
- { }
- { Copyright ⌐ 1997,2001 Michal Mutl }
- { }
- {*******************************************************}
-
- {$INCLUDE MITEC_DEF.INC}
-
- unit MSI_GUI;
-
- interface
-
- uses
- MSI_CPU, MSI_Machine, MSI_Devices, MSI_Display, MSI_Network, MSI_Media,
- MSI_Memory, MSI_Engines, MSI_APM, MSI_Disk, MSI_DirectX, MSI_OS, MSI_Processes,
- MSI_Printers, MSI_Software, MSI_Startup,
- SysUtils, Windows, Classes;
-
- const
- cCompName = 'MiTeC System Information Component';
- cVersion = '6.0';
- cCopyright = 'Copyright ⌐ 1997,2001 Michal Mutl';
-
- type
- TExceptionMode = (emRaise, emMessage, emSilent);
-
- TGetInfo = procedure of object;
-
- TMSystemInfo = class(TComponent)
- private
- FCPU: TCPU;
- FMemory: TMemory;
- FOS :TOperatingSystem;
- FDisk :TDisk;
- FMachine: TMachine;
- FNetwork: TNetwork;
- FDisplay: TDisplay;
- FEngines: TEngines;
- FDevices: TDevices;
- FAPM :TAPM;
- FAbout: string;
- FDirectX: TDirectX;
- FMedia: TMedia;
- FProcesses: TProcesses;
- FPrinters: TPrinters;
- FSoftware: TSoftware;
- FStartup: TStartup;
- FMode: TExceptionMode;
- {$IFNDEF D6PLUS}
- procedure SetAbout(const Value: string);
- {$ENDIF}
- public
- constructor Create(AOwner :TComponent); override;
- destructor Destroy; override;
- procedure Refresh;
- procedure Report(var sl :TStringList);
- procedure ShowModalOverview;
- procedure ShowModalOverviewWithAbout;
- procedure ShowOverview;
- procedure ShowOverviewWithAbout;
- published
- property About :string read FAbout {$IFNDEF D6PLUS} write SetAbout {$ENDIF} stored False;
- property ExceptionMode: TExceptionMode read FMode write FMode;
- property CPU :TCPU read FCPU {$IFNDEF D6PLUS} write FCPU {$ENDIF};
- property Memory :TMemory read FMemory {$IFNDEF D6PLUS} write FMemory {$ENDIF};
- property OS :TOperatingSystem read FOS {$IFNDEF D6PLUS} write FOS {$ENDIF};
- property Disk :TDisk read FDisk {$IFNDEF D6PLUS} write FDisk {$ENDIF};
- property Machine :TMachine read FMachine {$IFNDEF D6PLUS} write FMachine {$ENDIF};
- property Network :TNetwork read FNetwork {$IFNDEF D6PLUS} write FNetwork {$ENDIF};
- property Display :TDisplay read FDisplay {$IFNDEF D6PLUS} write FDisplay {$ENDIF};
- property Media :TMedia read FMedia {$IFNDEF D6PLUS} write FMedia {$ENDIF};
- property Devices :TDevices read FDevices {$IFNDEF D6PLUS} write FDevices {$ENDIF};
- property Engines :TEngines read FEngines {$IFNDEF D6PLUS} write FEngines {$ENDIF};
- property APM :TAPM read FAPM {$IFNDEF D6PLUS} write FAPM {$ENDIF};
- property DirectX :TDirectX read FDirectX {$IFNDEF D6PLUS} write FDirectX {$ENDIF};
- property Processes :TProcesses read FProcesses {$IFNDEF D6PLUS} write FProcesses {$ENDIF};
- property Printers :TPrinters read FPrinters {$IFNDEF D6PLUS} write FPrinters {$ENDIF};
- property Software :TSoftware read FSoftware {$IFNDEF D6PLUS} write FSoftware {$ENDIF};
- property Startup: TStartup read FStartup {$IFNDEF D6PLUS} write FStartup {$ENDIF};
- end;
-
- implementation
-
- uses MSI_Overview, MiTeC_Routines;
-
- procedure MSafeCall(Func: TGetInfo; Description: string; Mode: TExceptionMode);
- begin
- try
- Func;
- except
- on e: exception do begin
- case Mode of
- emRaise: raise Exception.Create(Description+': '+e.message);
- emMessage: if IsConsole then
- writeln(Description+': '+e.message)
- else
- MessageBox(0,PChar(Description+': '+e.message),'Error',MB_OK or MB_ICONERROR);
- emSilent: ;
- end;
- end;
- end;
- end;
-
- { TMSystemInfo }
-
- constructor TMSystemInfo.Create(AOwner: TComponent);
- begin
- inherited;
- FAbout:=cCompName+' '+cVersion+' - '+cCopyright;
- FMode:=emMessage;
- FCPU:=TCPU.Create;
- FMemory:=TMemory.Create;
- FOS:=TOperatingSystem.Create;
- FDisk:=TDisk.Create;
- FMachine:=TMachine.Create;
- FNetwork:=TNetwork.Create;
- FDisplay:=TDisplay.Create;
- FMedia:=TMedia.Create;
- FDevices:=TDevices.Create;
- FEngines:=TEngines.Create;
- FAPM:=TAPM.Create;
- FDirectX:=TDirectX.Create;
- FProcesses:=TProcesses.Create;
- FPrinters:=TPrinters.Create;
- FSoftware:=TSoftware.Create;
- FStartup:=TStartup.Create;
- if csDesigning in ComponentState then
- Refresh;
- end;
-
- destructor TMSystemInfo.Destroy;
- begin
- FCPU.Free;
- FMemory.Free;
- FOS.Free;
- FDisk.Free;
- FMachine.Free;
- FNetwork.Free;
- FDisplay.Free;
- FMedia.Free;
- FDevices.Free;
- FEngines.Free;
- FAPM.Free;
- FDirectX.Free;
- FProcesses.Free;
- FPrinters.Free;
- FSoftware.Free;
- FStartup.Free;
- inherited;
- end;
-
- procedure TMSystemInfo.Refresh;
- begin
- MSafeCall(Devices.GetInfo,Devices.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(CPU.GetInfo,CPU.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Memory.GetInfo,Memory.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(OS.GetInfo,OS.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Disk.GetInfo,Disk.Classname+'.GetInfo',ExceptionMode);
- Disk.Drive:=ExtractFileDrive(GetWinDir);
- MSafeCall(Machine.GetInfo,Machine.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Network.GetInfo,Network.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Display.GetInfo,Display.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Media.GetInfo,Media.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Engines.GetInfo,Engines.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(APM.GetInfo,APM.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(DirectX.GetInfo,DirectX.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Processes.GetInfo,Processes.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Printers.GetInfo,Printers.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Software.GetInfo,Software.Classname+'.GetInfo',ExceptionMode);
- MSafeCall(Startup.GetInfo,Startup.Classname+'.GetInfo',ExceptionMode);
- end;
-
- procedure TMSystemInfo.Report(var sl: TStringList);
- begin
- sl.add('; '+About);
- sl.add('');
- Machine.Report(sl);
- OS.Report(sl);
- CPU.Report(sl);
- Memory.Report(sl);
- Display.Report(sl);
- APM.Report(sl);
- Media.Report(sl);
- Network.Report(sl);
- Devices.Report(sl);
- Engines.Report(sl);
- DirectX.Report(sl);
- Disk.Report(sl);
- Processes.Report(sl);
- Printers.Report(sl);
- Software.Report(sl);
- Startup.Report(sl);
- end;
-
- {$IFNDEF D6PLUS}
- procedure TMSystemInfo.SetAbout(const Value: string);
- begin
- end;
- {$ENDIF}
-
- procedure TMSystemInfo.ShowModalOverview;
- begin
- with TfrmMSI_Overview.Create(nil) do begin
- SysInfo:=Self;
- DisplayedPages:=pgAll;
- ShowReportButton:=True;
- cmRefresh(nil);
- ShowModal;
- Free;
- end;
- end;
-
- procedure TMSystemInfo.ShowModalOverviewWithAbout;
- begin
- with TfrmMSI_Overview.Create(nil) do begin
- SysInfo:=Self;
- DisplayedPages:=pgAll+[pgAbout];
- ShowReportButton:=True;
- cmRefresh(nil);
- ShowModal;
- Free;
- end;
- end;
-
- procedure TMSystemInfo.ShowOverview;
- begin
- try
- frmMSI_Overview.Show;
- except
- frmMSI_Overview:=TfrmMSI_Overview.Create(nil);
- with frmMSI_Overview do begin
- SysInfo:=Self;
- DisplayedPages:=pgAll;
- ShowReportButton:=True;
- cmRefresh(nil);
- Show;
- end;
- end;
- end;
-
- procedure TMSystemInfo.ShowOverviewWithAbout;
- begin
- try
- frmMSI_Overview.Show;
- except
- frmMSI_Overview:=TfrmMSI_Overview.Create(nil);
- with frmMSI_Overview do begin
- SysInfo:=Self;
- DisplayedPages:=pgAll+[pgAbout];
- ShowReportButton:=True;
- cmRefresh(nil);
- Show;
- end;
- end;
- end;
-
- end.
-
-