Mega Code Archive

 
Categories / Delphi / Examples
 

Find full path of registered Applications

Title: Find full path of registered Applications Question: Open the windows start menu - execute and type in: wordpad This will start the WordPad. But how does this work? Some Applications are registered in the Registry. e.g.: dialer, WinWord, Excel, mplayer, Winzip, .... Answer: uses Registry, RegStr; function TrueExecutablePath(const path:string):string; var Reg: TRegistry; begin result := path; if not FileExists(path) then begin Reg := TRegistry.Create; try Reg.RootKey := HKEY_LOCAL_MACHINE; Reg.Access := KEY_READ; if Reg.OpenKey(REGSTR_PATH_APPPATHS+'\'+path, False) or Reg.OpenKey(REGSTR_PATH_APPPATHS+'\'+path+'.exe',False) then result := Reg.ReadString('') finally Reg.CloseKey; Reg.Free; end; end; end; see also article 1007. please drop me a mail, if there is a shell function, with scans the search paths too. (there must be one, because the shell searches the registry and the search paths)