From af4fd0bee26f90fe2fb947ef6e53ba524297ce34 Mon Sep 17 00:00:00 2001 From: Nikolaos Georgiou Date: Fri, 29 Oct 2021 07:57:16 +0200 Subject: [PATCH] Dynamically showing the version in the about box --- about1.lfm | 1 + about1.pas | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/about1.lfm b/about1.lfm index 1e983b7..6746bdb 100644 --- a/about1.lfm +++ b/about1.lfm @@ -10,6 +10,7 @@ object AboutBox: TAboutBox Font.Color = clWindowText Font.Height = -14 Font.Name = 'Tahoma' + OnCreate = FormCreate Position = poScreenCenter LCLVersion = '2.0.6.0' object Panel1: TPanel diff --git a/about1.pas b/about1.pas index dfaf755..31b7816 100644 --- a/about1.pas +++ b/about1.pas @@ -5,9 +5,12 @@ unit about1; interface uses SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, - Buttons, ExtCtrls; + Buttons, ExtCtrls, fileinfo; type + + { TAboutBox } + TAboutBox = class(TForm) Panel1: TPanel; ProductName: TLabel; @@ -15,6 +18,7 @@ type Copyright: TLabel; Comments: TLabel; OKButton: TButton; + procedure FormCreate(Sender: TObject); private { Private declarations } public @@ -28,5 +32,20 @@ implementation {$R *.lfm} +{ TAboutBox } + +procedure TAboutBox.FormCreate(Sender: TObject); +var + FileVerInfo: TFileVersionInfo; +begin + FileVerInfo := TFileVersionInfo.Create(nil); + try + FileVerInfo.ReadFileInfo; + Version.Caption := 'Version ' + FileVerInfo.VersionStrings.Values['FileVersion']; + finally + FileVerInfo.Free; + end; +end; + end.