简体   繁体   English

有没有办法找到Delphi编译器版本?

[英]Is there a way to find the Delphi compiler version?

I try to find programmatically the version of Delphi compiler(s) installed on my machine. 我试图以编程方式找到我机器上安装的Delphi编译器的版本。

I'm looking in the registry but without success. 我正在寻找注册表但没有成功。 I'm using Windows 7-64bits Professional 我正在使用Windows 7-64bits Professional

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: 例如,Delphi 6是:

HKLM\Software\Borland\Delphi\6.0

Delphi 2010 is: Delphi 2010是:

HKLM\Software\CodeGear\BDS\7.0

Delphi XE5 is: Delphi XE5是:

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. 如果您使用的是64位计算机,请务必查看32位注册表视图。 The registry redirector will take care of that for you if your process is a 32 bit process. 如果您的进程是32位进程,注册表重定向器将为您处理。 But you might get confused when looking under regedit. 但是,在注册regedit时你可能会感到困惑。 When viewing in regedit these keys become 在regedit中查看时,这些键变为

HKLM\Software\Wow6432Node\...

@RRUZ has a nice post about this here: http://theroadtodelphi.wordpress.com/2010/10/27/detecting-installed-delphi-versions/ @RRUZ在这里有一个很好的帖子: http ://theroadtodelphi.wordpress.com/2010/10/27/detecting-installed-delphi-versions/

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. 您可以重复使用已经过tred和测试过的解决方案,而不是浪费时间在NIH方法上。

For example, you may take JEDI CodeLib and look into jcl\\source\\common\\JclIDEUtils.pas 例如,您可以使用JEDI CodeLib并查看jcl \\ source \\ common \\ JclIDEUtils.pas

And the practical example of yousage those functions is the installer itself: jcl\\install\\JediInstaller.dpr 而这些函数的实际示例是安装程序本身: jcl \\ install \\ JediInstaller.dpr

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM