Reputation: 173
I try to find programmatically the version of Delphi compiler(s) installed on my machine.
I'm looking in the registry but without success. I'm using Windows 7-64bits Professional
Upvotes: 1
Views: 1297
Reputation: 16065
I believe you can take any open-source library having the installer. That already was solved in it one way or another. And you can re-use already tred and tested solution instead of wasting your time on NIH-approach.
For example, you may take JEDI CodeLib
and look into jcl\source\common\JclIDEUtils.pas
And the practical example of yousage those functions is the installer itself: jcl\install\JediInstaller.dpr
Upvotes: 0
Reputation: 613461
You can inspect the registry. Look under these keys:
HKLM\Software\Borland\Delphi
HKLM\Software\CodeGear\BDS
HKLM\Software\Embarcadero\BDS
Under each of those keys you will find subkeys with a version number. For example, Delphi 6 is:
HKLM\Software\Borland\Delphi\6.0
Delphi 2010 is:
HKLM\Software\CodeGear\BDS\7.0
Delphi XE5 is:
HKLM\Software\Embarcadero\BDS\12.0
Note that this will not guarantee that the installations are in fully working order, mind you.
Also be sure to look in the 32 bit registry view if you are on a 64 bit machine. The registry redirector will take care of that for you if your process is a 32 bit process. But you might get confused when looking under regedit. When viewing in regedit these keys become
HKLM\Software\Wow6432Node\...
@RRUZ has a nice post about this here: http://theroadtodelphi.wordpress.com/2010/10/27/detecting-installed-delphi-versions/
Upvotes: 3