作者在 2010-01-25 17:53:48 发布以下内容
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Registry,INIFILES; //必须加入
type
TForm1 = class(TForm)
Button1: TButton;
RadioButton1: TRadioButton;
Memo1: TMemo;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var reg,reg1:TRegistry;
begin
reg:=TRegistry.Create;
reg.RootKey:=HKEY_LOCAL_MACHINE;
If RadioButton1.Checked Then
if reg.OpenKey('HARDWARE\DESCRIPTION\System',false) then
Begin
Memo1.Clear; //清空原来的内容
memo1.lines.add('系统BIOS日期 '+reg.ReadString('SystemBiosDate'));
memo1.lines.add('BIOS标志符 '+reg.ReadString('Identifier'));
end;
reg.closekey;
If RadioButton2.Checked Then
Begin
Memo1.Clear; //清空原来的内容
if reg.OpenKey('hardware\description\system\centralprocessor\0',false) then
Begin
memo1.lines.add('中央处理器CPU标识 '+reg.ReadString('VendorIdentifier'));
memo1.lines.add('中央处理器CPU型号 '+reg.ReadString('Identifier'));
end;
reg.closekey;
if reg.OpenKey('hardware\description\system\FloatingPointProcessor\0',false) then
Begin
memo1.lines.add('浮点处理CPU型号 '+reg.ReadString('Identifier'));
end;
reg.closekey;
end;
reg1:=TRegistry.Create;
reg1.RootKey:=HKEY_CURRENT_USER; //获取电源信息
If RadioButton3.Checked Then
Begin
Memo1.Clear; //清空原来的内容
if reg1.OpenKey('Control Panel\PowerCfg\PowerPolicies\0',false) then
memo1.lines.add('电源使用方案一 '+reg1.ReadString('Name'));
reg1.closekey;
if reg1.OpenKey('Control Panel\PowerCfg\PowerPolicies\1',false) then
memo1.lines.add('电源使用方案二 '+reg1.ReadString('Name'));
reg1.closekey;
if reg1.OpenKey('Control Panel\PowerCfg\PowerPolicies\2',false) then
memo1.lines.add('电源使用方案三 '+reg1.ReadString('Name'));
reg1.closekey;
if reg1.OpenKey('Control Panel\PowerCfg\PowerPolicies\3',false) then
memo1.lines.add('电源使用方案四 '+reg1.ReadString('Name'));
reg1.closekey;
if reg1.OpenKey('Control Panel\PowerCfg\PowerPolicies\4',false) then
memo1.lines.add('电源电池方案五 '+reg1.ReadString('Name'));
reg1.closekey;
if reg1.OpenKey('Control Panel\PowerCfg\PowerPolicies\5',false) then
memo1.lines.add('电源使用方案六 '+reg1.ReadString('Name'));
reg1.closekey;
end;
reg1.closekey;
end;
end.