How do I get version of my application?

3

I need a way to get the version of my application in C ++ Builder , to put in the Caption of a TLabel , which will be displayed next to a home screen system presentation.

    
asked by anonymous 26.07.2016 / 17:30

1 answer

2

Similar to your question in SOen .

But as this is Delphi, I use a function that works both in Builder and Delphi:

function GetAppVersion: string;
var
  Versao: LongRec;
begin
  Versao:= LongRec(GetFileVersion(ParamStr(0)));
  Result := Format('%d.%d', [Versao.Hi, Versao.Lo])
end;

To use just receive the result of the GetAppVersion function in the Caption of the component.

Where:

Versao.Hi = Major Version
Versao.Lo = Minor Version
    
26.07.2016 / 20:15