请问HeyTommy,这段源码为什么出错?(0分)

  • 主题发起人 主题发起人 thebluehouse
  • 开始时间 开始时间
T

thebluehouse

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.
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Registry;

type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
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');
checkbox1.checked:=true;
end
else
ShowMessage('ProductID is not exist!');
end;
finally
TempReg.CloseKey;
TempReg.Free;
end;
end;

end.
这个呢?一样地方出错!
 
后退
顶部