Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the version number of the current FMX project in Delphi 12?

The Delphi 12 IDE allows editing of the FMX module version number in Project | Options | Application | Version Info.

How can I access the build number of my FMX project in code?

like image 530
Mike at Bookup Avatar asked Oct 30 '25 10:10

Mike at Bookup


2 Answers

GetVersionString (from FMX.Platform.IFMXApplicationService) returns a string with the version number of the application.

All the details are available here:

  • https://docwiki.embarcadero.com/Libraries/Athens/en/FMX.Platform.IFMXApplicationService.AppVersion
  • https://docwiki.embarcadero.com/Libraries/Athens/en/FMX.Platform.IFMXApplicationService.GetVersionString
like image 159
Fernando Rizzato Avatar answered Nov 02 '25 01:11

Fernando Rizzato


Delphi's documentation sucks. It doesn't show the correct way to use the function.

It should be like this:

function GetAppVersion: string;
var
  AppService: IFMXApplicationService;
begin
  if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationService, IInterface(AppService)) then
    Result := AppService.AppVersion
  else
    Result := 'Version info not available';
end;
like image 41
Gumadara Santos Avatar answered Nov 02 '25 00:11

Gumadara Santos