[Lazarus] Build Number

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Jul 23 10:05:30 CEST 2010


On Fri, 23 Jul 2010 15:59:00 +0800
Paul Ishenin <ip at kmiac.ru> wrote:

> 23.07.2010 15:50, Kjow wrote:
> > When I do "Build all" the build number of my developed application
> > will increase (e.g. 0.0.0.1 ->  0.0.0.2 ->  0.0.0.3 ->  etc ), and if I
> > want to include this info in the GUI of the same application I need to
> > modify everytime by hand this value. So it would be very nice if there
> > will be a constant where get this value dinamically.
> 
> This constanst is stored as a resource of your application. You can read 
> it by accessing this resource.
> 
> I attached a small utility unit which helps with the version info 
> extraction.
> 
> Here is a small example of how to use it (add vinfo and versiontypes 
> units to your uses section):
> 
> procedure TForm1.Button1Click(Sender: TObject);
> 
>    function ProductVersionToString(PV: TFileProductVersion): String;
>    begin
>      Result := Format('%d.%d.%d.%d', [PV[0],PV[1],PV[2],PV[3]])
>    end;
> 
> var
>    Info: TVersionInfo;
> begin
>    Info := TVersionInfo.Create;
>    Info.Load(HINSTANCE);
>    ShowMessage(ProductVersionToString(Info.FixedInfo.FileVersion));
>    ShowMessage(ProductVersionToString(Info.FixedInfo.ProductVersion));
>    Info.Free;
> end;

Maybe it should be added somewhere in the documentation?
including the requirements.

Mattias




More information about the Lazarus mailing list