Mega Code Archive

 
Categories / Delphi / Examples
 

How determine if a ANY app is installed

Title: How determine if a ANY app is installed. Question: How determine if a ANY app is installed. Answer: In some moment is necessary to know if some program is installed or not to accomplish some task and also is I presented me on one occasion the need of determining if Delphi was installed, used a similar routine to the one which I go to present. However this was modified so that could determine the presence of any program always through its exe file (executable)Create a function that accept an entry parameter, that it will be the name of the EXE file for example: delphi32.exe, icq.exe, winword.exe... it is obvious that it must know if the name of the EXE file of the application that seeks: Function IsInstalled (FileExe: String): Boolean; var reg : TRegistry; temp: String Begin Result:=False; Reg:= Tregistry.Create; Try Reg.RootKey:= HKEY_LOCAL_MACHINE; If Reg.OpenKey ('\Software\Microsoft\Windows\CurrentVersion\App Paths\+FileExe,FALSE) Then if Reg.ValueExists('') then begin temp := Reg.ReadString('Path'); Result := FileExists(temp+\+FileExe); End; Finally Reg.Free; End; End; I wrote this, practically of memory, if I committed some mistake please send me a e-mail to amend this article. Regards.