Wenn Du speziell das WordPadDir suchst, ist es besser mit folgender Funktion:
Delphi-Quellcode:
uses ..., Registry,...
function WordPadDir: string;
var
reg: TRegistry;
begin
reg := TRegistry.Create;
with reg do
try
RootKey := HKEY_LOCAL_MACHINE;
Result := '';
if OpenKey('\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WORDPAD.EXE', False) then
Result := ReadString('');
Result := ExtractFilePath(Result); // leaves the trailing backslash intact
finally
Free;
end;
end;