Delphi Version Numbers

Posted : admin On 4/26/2019

In Delphi 2010, if I want to do this:

What version # do I need to use in place of '999'?

JosephStyonsJosephStyons

5 Answers

Red HazeRed Haze

Here's the list of compiler versions:

In Delphi 2007, VER180 and VER185 are both defined. This was for backward compatibility with Delphi 2006, and to make sure you could also detect D2007 specifically.

I'm not sure why they did that between '06 and '07, but not for other releases. Seems inconsistent to me (but it isn't - see Barry Kelly's comment below).

JosephStyonsJosephStyons

If you're working with Delphi 6 and later, you can use CompilerVersion:

jasonpennyjasonpenny
Bruce McGeeBruce McGee

Along the same lines as Jason's comment if you are creating code that needs to run in current and older versions of Delphi you might want to do something like:

TheStevenTheSteven

protected by CommunityMay 8 '11 at 17:04

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged delphidelphi-2010 or ask your own question.

Want to obtain Delphi Application build number and post into title bar

Link WilsonLink Wilson

6 Answers

Here is how I do it. I put this in almost all of my small utilities:

MickMick

I most strongly recommend not to use GetFileVersion when you want to know the version of the executable that is currently running! I have two pretty good reasons to do this:

  1. The executable may be unaccessible (disconnected drive/share), or changed (.exe renamed to .bak and replaced by a new .exe without the running process being stopped).
  2. The version data you're trying to read has actually already been loaded into memory, and is available to you by loading this resource, which is always better than to perform extra (relatively slow) disk operations.

To load the version resource in Delphi I use code like this:

Stijn SandersStijn Sanders

Pass the full file name of your EXE to this function, and it will return a string like:2.1.5.9, or whatever your version # is.

After defining that, you can use it to set your form's caption like so:

JosephStyonsJosephStyons

Thanks to the posts above, I made my own library for this purpose.

I believe that it is a little bit more correct than all other solutions here, so I share it - feel free to reuse it...

Jiri KrivanekJiri Krivanek

From http://www.martinstoeckli.ch/delphi/delphi.html#AppVersion

With this function you can get the version of a file, which contains a version resource. This way you can display the version number of your application in an information dialog. To include a version resource to your Delphi application, set the 'Versioninfo' in the project options.

vIceBergvIceBerg

We do this for all our apps but we use a Raize component RzVersioninfo.works quite well just need to use the following code

on form create

Caption := RzVersioninfo1.filedescripion + ': ' + RzVersionInfo1.FileVersion;

obviously if you don't want any of the other components from raize use one of the options above as there is a cost to the raize components.

LizHansonLizHanson

Not the answer you're looking for? Browse other questions tagged delphiversion or ask your own question.