Da fehlen noch Resourcenschutzblöcke und ein
CloseKey:
Delphi-Quellcode:
uses registry;
function getAppPath(const App: String): String;
var
reg: Tregistry;
path: String;
begin
reg := Tregistry.Create;
try
with reg do
begin
RootKey := HKEY_LOCAL_MACHINE;
if Openkey('Software\Microsoft\Windows\CurrentVersion\App Paths\' + App, true) then
begin
path := ReadString('Path');
CloseKey;
result := path;
end else
result := '';
end;
finally
FreeAndNil(reg);
end;
end;