[Lazarus] Build Number

Paul Ishenin ip at kmiac.ru
Fri Jul 23 09:59:00 CEST 2010


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;

Best regards,
Paul Ishenin.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vinfo.pas
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100723/8db6b97e/attachment-0004.ksh>


More information about the Lazarus mailing list