uses Registry;
function ProgrammOrdner(RelativPfad: Boolean): String;
var
Reg: TRegistry;
begin
Result := '';
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion', False) then
begin
if RelativPfad then
Result := Reg.ReadString('ProgramFilesPath')
else
Result := Reg.ReadString('ProgramFilesDir');
end;
finally
Reg.CloseKey;
Reg.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Showmessage(ProgrammOrdner(False));
end;