Ian Branch 127 Posted Thursday at 07:27 PM Hi Team, At the moment I use a variable to indicate the Delphi version for an About box in Apps. This looks like this: Delphi Athens 12.2 Patch 2. Is there some meaans within Delphi to return this information, or a reasonable semblance, so I don't have to manually update the About box? Regards & TIA, Ian Share this post Link to post
Anders Melander 1780 Posted Thursday at 08:14 PM You can use the CompilerVersion constant. See system.pas The question really is: Why do you need this information at all? The users doesn't need it and supposedly you yourself know which version you used... 2 Share this post Link to post
Ian Branch 127 Posted Thursday at 09:28 PM 1 hour ago, Anders Melander said: You can use the CompilerVersion constant. See system.pas That will only return 36. 1 hour ago, Anders Melander said: The question really is: Why do you need this information at all? The users doesn't need it and supposedly you yourself know which version you used... Call it a personal preference, I like to have the information in the About dialog. Saying the Application was built with 'Delphi v 36' isn't as informative as 'Delphi Athens v 12.2 Patch 2'. Share this post Link to post
Anders Melander 1780 Posted Thursday at 09:31 PM 1 minute ago, Ian Branch said: That will only return 36. If you contact a developer I'm sure they can figure out a way to translate this, uniquely identifying number, to a string value of your choice. Share this post Link to post
Ian Branch 127 Posted Thursday at 09:35 PM 1 minute ago, Anders Melander said: If you contact a developer I'm sure they can figure out a way to translate this, uniquely identifying number, to a string value of your choice. As could I, but I was hoping for something more informative from Delphi. That 'uniquely identifying number' is applicable to Delphi 12.0, 12.1, 12.2, 12.2 Patch 1 & 12.2 Patch 2. Never mind. I will stick with manual updates as required. Share this post Link to post
DelphiUdIT 172 Posted Thursday at 10:59 PM (edited) 3 hours ago, Ian Branch said: Is there some meaans within Delphi to return this information, or a reasonable semblance, so I don't have to manually update the About box? Yes, you can use the GetRTLVersion function. That return the Major release and Minor release ... for example Athens12.2 -> is $2402 Only Update level version, no patch informations. It is a new function that works from Athens 12. Edited Thursday at 11:04 PM by DelphiUdIT Share this post Link to post
Angus Robertson 574 Posted Friday at 09:00 AM ICS has a function IcsBuiltWith that uses a lot of defines to get the version, ie 12.2, but not patches. Not much code, but it does need an insert file that does most of the version checking. Several ICS samples report the Delphi version, which is useful. Angus Share this post Link to post
limelect 48 Posted Friday at 09:24 AM (edited) TjvVersionInfo does the job. From my software uses JvVersionInfo var VerInfo: TjvVersionInfo; begin AboutBox := TAboutBox.Create(Application); try VerInfo := TJvVersionInfo.Create(Application.ExeName); AboutBox.Version.Caption := ' Ver ' + VerInfo.FileVersion; Edited Friday at 09:40 AM by limelect Share this post Link to post
DelphiUdIT 172 Posted Friday at 09:45 AM (edited) 1 hour ago, limelect said: TjvVersionInfo does the job. From my software var VerInfo: TjvVersionInfo; begin AboutBox := TAboutBox.Create(Application); try VerInfo := TJvVersionInfo.Create(Application.ExeName); AboutBox.Version.Caption := ' Ver ' + VerInfo.FileVersion; It come from INFO from application setting. You can use also in this way (I use it since decades without JVCL) ( EDIT :THIS EXAMPLE REPORT INFO FROM APP INFO, NOT FROM DELPHI VERSION !!!) function GetAppVersion: string; var Size, Size2: DWord; Pt, Pt2: Pointer; begin Size := GetFileVersionInfoSize(PChar (ParamStr (0)), Size2); if Size > 0 then begin GetMem (Pt, Size); try GetFileVersionInfo (PChar (ParamStr (0)), 0, Size, Pt); VerQueryValue (Pt, '\', Pt2, Size2); with TVSFixedFileInfo (Pt2^) do begin Result:= 'Version: '+ IntToStr (HiWord (dwFileVersionMS)) + '.' + IntToStr (LoWord (dwFileVersionMS)) + '.' + IntToStr (HiWord (dwFileVersionLS)) + '.' + IntToStr (LoWord (dwFileVersionLS)); end; finally FreeMem (Pt); end; end else begin Result:= 'Version: NOT RECOGNIZED'; end; end; I think he wants to have the version of RAD STUDIO that build the exe file. The GetRTLVersion do this (to UPDATE level) and it is include in the System Unit. Edited Friday at 10:45 AM by DelphiUdIT Share this post Link to post
limelect 48 Posted Friday at 10:03 AM (edited) @DelphiUdIT I tested your function on D10.2.3 and it return program version and NOT the Delphi version As for that mine is simple Edited Friday at 10:04 AM by limelect Share this post Link to post
Anders Melander 1780 Posted Friday at 10:27 AM 23 minutes ago, limelect said: As for that mine is simple ...and still not relevant to the OPs request Share this post Link to post
DelphiUdIT 172 Posted Friday at 10:42 AM 34 minutes ago, limelect said: @DelphiUdIT I tested your function on D10.2.3 and it return program version and NOT the Delphi version As for that mine is simple 11 minutes ago, Anders Melander said: ...and still not relevant to the OPs request I explain BAD: the example I suggest is like @limelect do with JVCL -> VERSION IS FROM APP INFO, NOT FROM DELPHI VERSION. FOR Delphi version, like I told more times there is the "GetRTLVersion" function from System uniti: https://docwiki.embarcadero.com/Libraries/Athens/en/System.GetRTLVersion Share this post Link to post
limelect 48 Posted Friday at 10:44 AM (edited) I found this on my CodeSnipet Returns the version of the Delphi or Free Pascal compiler used to compile the program. 0.0 is returned on error, or if the compiler is not recognized. On test on D10.2.3 it return 32 I hop it helps It works for this https://docwiki.embarcadero.com/RADStudio/Athens/en/Compiler_Versions function CompilerVer: Double; begin {$UNDEF HAVE_RESULT} {$IFNDEF FPC} // Delphi {$IFDEF VER90} {$DEFINE HAVE_RESULT} Result := 9.0; // Delphi 2 {$ENDIF} {$IFDEF VER100} {$DEFINE HAVE_RESULT} Result := 10.0; // Delphi 3 {$ENDIF} {$IFDEF VER120} {$DEFINE HAVE_RESULT} Result := 12.0; // Delphi 4 {$ENDIF} {$IFDEF VER130} {$DEFINE HAVE_RESULT} Result := 13.0; // Delphi 5 {$ENDIF} {$IFDEF CONDITIONALEXPRESSIONS} {$IF Declared(CompilerVersion)} {$DEFINE HAVE_RESULT} Result := CompilerVersion; // Delphi 6 and later {$IFEND} {$ENDIF} {$ELSE} // Free Pascal {$IFDEF VER1} {$DEFINE HAVE_RESULT} Result := 1.0; // FPC v1.x {$ENDIF} {$IFDEF VER2} {$DEFINE HAVE_RESULT} Result := 2.0; // FPC v2.x {$ENDIF} {$ENDIF} {$IFNDEF HAVE_RESULT} Result := 0.0; {$ENDIF} {$UNDEF HAVE_RESULT} end; Edited Friday at 10:52 AM by limelect Share this post Link to post
DelphiUdIT 172 Posted Friday at 10:52 AM 2 minutes ago, limelect said: I found this on my CodeSnipet Returns the version of the Delphi or Free Pascal compiler used to compile the program. 0.0 is returned on error, or if the compiler is not recognised. ....................... You don't have the UPDATE version of RTL (I mean 12.0, 12.1, 12.2) with VERxxx. By now if you see a lot of packages like Indy, FastReport, Jvcl, etc ... they use near they same like you example, but there is not minor version (UPDATE) identity: you can see Delphi12 but not Delphi 12.2, all minor releases are indentified like Delphi12. Share this post Link to post
limelect 48 Posted Friday at 10:56 AM (edited) @DelphiUdIT as per https://docwiki.embarcadero.com/RADStudio/Athens/en/Compiler_Versions It does not have 12.1 or 2 May be 37 or 38? Edited Friday at 10:56 AM by limelect Share this post Link to post
Angus Robertson 574 Posted Friday at 11:39 AM {$IF Declared(RTLVersion121)}Result := '12.1';{$IFEND} {$IF Declared(RTLVersion122)}Result := '12.2';{$IFEND} {$IF Declared(RTLVersion123)}Result := '12.3';{$IFEND} // guessing Angus Share this post Link to post
Lajos Juhász 293 Posted Friday at 11:45 AM 5 minutes ago, Angus Robertson said: {$IF Declared(RTLVersion123)}Result := '12.3';{$IFEND} // guessing Embarcadero could have that: https://docwiki.embarcadero.com/Libraries/Athens/en/System RTLVersion RTLVersion: Comp = 36; RTLVersion121 RTLVersion121: Boolean = True; RTLVersion122 RTLVersion122: Boolean = True; RTLVersion123 RTLVersion123: Boolean = True; Share this post Link to post