B
bluehouse
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,registry, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
TempReg:TRegistry;
TempValue:string;
begin
TempReg:=TRegistry.Create;
try
TempReg.RootKey:=HKEY_LOCAL_MACHINE;
if TempReg.OpenKey('/Software/Microsoft/Windows/CurrentVersion/',false) then
begin
if tempreg.ValueExists('ProductId') then
begin
TempValue:=TempReg.ReadString('ProductId');
label1(出错).caption:=tempvalue;
end
else
ShowMessage('ProductID is not exist!');
end;
finally
TempReg.CloseKey;
TempReg.Free;
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,registry, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
TempReg:TRegistry;
TempValue:string;
begin
TempReg:=TRegistry.Create;
try
TempReg.RootKey:=HKEY_LOCAL_MACHINE;
if TempReg.OpenKey('/Software/Microsoft/Windows/CurrentVersion/',false) then
begin
if tempreg.ValueExists('ProductId') then
begin
TempValue:=TempReg.ReadString('ProductId');
label1(出错).caption:=tempvalue;
end
else
ShowMessage('ProductID is not exist!');
end;
finally
TempReg.CloseKey;
TempReg.Free;
end;
end;
end.