Registriert seit: 29. Mai 2002
37.621 Beiträge
Delphi 2006 Professional
|
Re: einzelnen TRegistry-Wert auslesen
17. Mär 2008, 22:08
Delphi-Quellcode:
uses
Registry;
function Foobar: String;
var
reg: TRegistry;
begin
result := ' ';
reg := TRegistry.Create(Key_Read);
try
reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey(' Software\Borland\Delphi\6.0\Library', False) then
begin
try
result := reg.ReadString(' Search Path');
except
raise Exception.Create(SysErrorMessage(GetLastError));
end;
end
else
raise Exception.Create(SysErrorMessage(GetLastError));
finally
reg.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s: String;
begin
try
s := Foobar;
ShowMessage(s);
except
on E: Exception do
ShowMessage(E. Message);
end;
end;
Michael Ein Teil meines Codes würde euch verunsichern.
|