Jump to content
Lainkes

Versioning in my program

Recommended Posts

Hello,

 

I want to use some kind of versioning in my program.

Example every time I build my program, I want to see in a text field the version. (ex 4.1.2).

And I also want to see the latest date when the program was build.  Maybe even add comments on what I changed in the program.

Is this a standard behaviour that I can use from Delphi? 

Or how can I implement this in my program?

 

Thanks for your advice.

 

Greetings

 

Alain

Share this post


Link to post

Do you want to embed this into your .exe version information or just to display it somewhere?

 

I'm asking because TAEUpdateFile which comes with TAEUpdater bundles all this information - you just have to fill them. The method FileVersion returns most what you'll need.

Share this post


Link to post

I just want to make it visible like in most programs when you click on the About link in the menu.

Is there some kind of tutorial about this? I never used components/code from outside the standard Delphi environment.

Share this post


Link to post

I know, I should write some documentation about most of my stuff...

Until then, there's a minimum example on how to create a sample update file in this post.

 

However, I started thinking. If you simply want to show it, why not a simple TMemo, which loads the information from a .TXT file / embedded resource / HTTP?

Share this post


Link to post
Posted (edited)

@Lainkes Under Project, Options, Version Info, you can choose to include version info with your project.  The version info includes the version number but also a number of other strings including Comments.

 

Your application can read those in a number of ways.   See for instance How to determine Delphi Application Version - Stack Overflow,

The most comprehensive way I found is using the Jcl library's unit JclFileInfo.  This unit includes a class TJclFileVersionInfo which provides easy access to all information stored in version info.

 

Here is for example a function that retrieves the version number using jcl:

 

function ApplicationVersion : string;
var
  ExeFile : string;
begin
  ExeFile := Application.ExeName;
  if VersionResourceAvailable(ExeFile) then begin
    with TJclFileVersionInfo.Create(ExeFile) do begin
      Result := BinFileVersion;
      Free;
    end;
  end else
    Result := '1.0.0';
end;

Note that this approach is Windows only.  For Andoid apps you can access the version info differently (e,g,How can I get at the file version info of a file when running Delphi on Android? - Stack Overflow

Edited by pyscripter

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×