Can I check the Indy version installed?

别说谁变了你拦得住时间么 提交于 2019-12-05 05:46:30

How to get version of Indy by using an Indy component at runtime ?

As @Remy pointed out in his comment, you can get the Indy version from any Indy component by using the Version property. Here's a sample using TIdHTTP component:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage('Indy version: ' + IdHTTP1.Version);
end;

How to get version of Indy without an Indy component at runtime ?

You can get the whole version string in Indy's versioning format:

<major>.<minor>.<release>.<build>

from the gsIdVersion constant defined in the IdVers.inc file included in the IdGlobal.pas unit in a way like follows:

uses
  IdGlobal;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage('Indy version: ' + gsIdVersion);
end;

or if you have Indy revision at least since 25th October 2012 (4850), you can use the individual version information elements, whose are defined in the same include file as mentioned before e.g. this way:

uses
  IdGlobal;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage('Indy version: ' +
    IntToStr(gsIdVersionMajor) + '.' +
    IntToStr(gsIdVersionMinor) + '.' +
    IntToStr(gsIdVersionRelease) + '.' +
    IntToStr(gsIdVersionBuild)
  );
end;

How to get version of Indy at design time ?

To get Indy version at design time you can simply right click any of the Indy's components dropped on a form and open its About box through the About Internet Direct (Indy)... menu item.

Where are the version information defined ?

As I've mentioned before, it's in the IdVers.inc include file stored in the ..\Lib\System\ folder of the library and it might be the next option of how to get the Indy's version information.

Disclaimer

Some of what was mentioned here applies to the Indy's most recent version at this time, but I'm not sure if it applies also to all older versions (such as Indy 9 for instance).

If your application already has an instance of an Indy component (which inherits TIdBaseComponent), you can get the version simply by

Version := SomeIndyComponent.Version;

in the current version, this function will return 10.5.9.0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!