I need to use the latest Indy component library version. Can I get the library version by some source code command or any other trick to make sure I'm using the correct lib.
I know I'm using the indy....160.bpl
- this is what my Delphi XE2 says while moving the mouse over the component bar. The latest INDY lib I take from Fulgan Indy

- 123,280
- 14
- 225
- 444

- 1,571
- 1
- 19
- 44
2 Answers
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).

- 75,147
- 17
- 214
- 392
-
the first version works fine for me , the second solution fails because gsIdVersionMajor is not found. Should I incluse any other library – user1769184 Jan 20 '13 at 12:14
-
checked my inc file, the reason why version 2 does nor work, these constants are mor defined here – user1769184 Jan 20 '13 at 12:21
-
Now looking at the revision history, Remy added those `gsIdVersionXXX` constants on 25th October 2012, so it's quite a new thing. I'll include this information into the post. – TLama Jan 20 '13 at 12:27
-
1@TLama: the `gsIdVersionXXX` defines are not defined in the public **trunk** branch of Indy 10's SVN repository. They are defined in the **DelphiNextGen** branch instead, which is not for public use yet. – Remy Lebeau Jan 21 '13 at 11:00
-
1@TLama: BTW, you missed an option. Instead of using `gsIdVersion` directly, every Indy component has a public `IndyVersion` property available that returns the version string (this is the same property value that the design-time About dialog shows). – Remy Lebeau Jan 21 '13 at 11:03
-
I'm just trying to figure out how to conditionally check the Indy version at compile-time. There's a feature in newer versions of Indy, and would like to compile for multiple versions (open-source project). I found `IdVers.inc`, but this doesn't seem to define any conditionals - only constants. – Jerry Dodge Jun 30 '19 at 15:59
-
Asked a new related question: https://stackoverflow.com/questions/56826276/how-to-conditionally-compile-a-newer-indy-feature – Jerry Dodge Jun 30 '19 at 16:09
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

- 36,362
- 28
- 176
- 378
-
`GetIndyVersion()` is the getter for the public `IndyVersion` property. Use the property, not the getter directly: `Version := SomeIndyComponent.IndyVersion;` – Remy Lebeau Jan 21 '13 at 11:06
-
2@Remy, thanks for the note at my post. But anyway, it's called [`Version`](http://www.indyproject.org/docsite/html/TIdBaseComponent_Version.html), not `IndyVersion`. [+1] – TLama Jan 21 '13 at 11:47