Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-07

Build Number

18 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Kjow

Hi all,

Is it possible to use inside the application the build number? Since Lazarus has an auto-increment of the build number, I would to include a label with the revision in the gui of my app... :)

Thanks,
Kjow

Reply by email

Mattias Gaertner
to Kjow
Show quoted text 5 lines
Hi all, Is it possible to use inside the application the build number? Since Lazarus has an auto-increment of the build number, I would to include a label with the revision in the gui of my app... :)

No.

Unless you write a tool/script that is called before compile and updates an include file used by the application. The IDE does that for svn revision number.

Mattias

Reply by email

Paul Ishenin
to Mattias Gaertner
Mattias Gaertner wrote 9 lines
> Is it possible to use inside the application the build number? Since > Lazarus has an auto-increment of the build number, I would to include > a label with the revision in the gui of my app... :) No. Unless you write a tool/script that is called before compile and updates an include file used by the application. The IDE does that for svn revision number.

I think Kjow is asking about the auto increment build number feature which increases the version on every build. If so then yes - it is possible to show in a label. If you need an easy class to extract the version information from the resource I can publish it.

Best regards,
Paul Ishenin.

Reply by email

waldo kitty
to Mattias Gaertner: On Thu, 22 Jul 2010 23:42:41 +0200 No. Unless you write a tool/script that is called…
Mattias Gaertner wrote 14 lines
On Thu, 22 Jul 2010 23:42:41 +0200 Kjow wrote: > Hi all, > > Is it possible to use inside the application the build number? Since > Lazarus has an auto-increment of the build number, I would to include > a label with the revision in the gui of my app... :) No. Unless you write a tool/script that is called before compile and updates an include file used by the application. The IDE does that for svn revision number.

on the surface, this would seem to be similar to the C style preprocessor stuff that takes "macros" like __DATE__ and __TIME__ and converts them to the current date and time and writes them into the object code... i did something like this for TP6/BP6 way back in the day... set those as consts in an include that was rewritten each time by my preprocessor before the command line compiler was called... actually using them (ie: forcing them to be included in the binary) required that at least one const string be used in the execution of the program... these didn't have to be used in the code but they were included such that one could see them in the binary when it was viewed via a hex editor/viewer...

Reply by email

Kjow
to Paul Ishenin: I think Kjow is asking about the auto increment build number feature which increases the…

2010/7/23 Paul Ishenin :

Show quoted text 16 lines
?23.07.2010 6:12, Mattias Gaertner wrote: > >> Is it possible to use inside the application the build number? Since >> Lazarus has an auto-increment of the build number, I would to include >> a label with the revision in the gui of my app... :) > > No. > > Unless you write a tool/script that is called before compile and > updates an include file used by the application. The IDE does that for > svn revision number. I think Kjow is asking about the auto increment build number feature which increases the version ?on every build. If so then yes - it is possible to show in a label. If you need an easy class to extract the version information from the resource I can publish it.

es, I mean the build number of developed applications, not lazarus or fpc.

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.

Regards,
Kjow

Reply by email

Paul Ishenin
to Kjow
Kjow wrote 5 lines
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.freepascal.org/pipermail/lazarus/attachments/20100723/8db6b97e/attachment.ksh>

Reply by email

Mattias Gaertner
to Paul Ishenin
Show quoted text 32 lines
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

Reply by email

Kjow
to Paul Ishenin: This constanst is stored as a resource of your application. You can read it by accessing…

2010/7/23 Paul Ishenin :

Show quoted text 28 lines
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.

Thank you, but my Lazarus (r26732M) can't find vinfo unit.

Other question: Is this procedure multiplatform compatible? ( => Does it work on Linux?)

Regards,
Kjow

Reply by email

Sven Barth
to waldo kitty: on the surface, this would seem to be similar to the C style preprocessor stuff that…

Hi!

waldo kitty wrote 11 lines
on the surface, this would seem to be similar to the C style preprocessor stuff that takes "macros" like __DATE__ and __TIME__ and converts them to the current date and time and writes them into the object code... i did something like this for TP6/BP6 way back in the day... set those as consts in an include that was rewritten each time by my preprocessor before the command line compiler was called... actually using them (ie: forcing them to be included in the binary) required that at least one const string be used in the execution of the program... these didn't have to be used in the code but they were included such that one could see them in the binary when it was viewed via a hex editor/viewer...

Did you know about this:

===

program Foo;
{$apptype console}
begin
   Writeln({$I %DATE%} + ' ' + {$ %TIME%});
   Readln;
end.

===

Output:

2010/07/23 10:13:40

===

It's documented here:
http://www.freepascal.org/docs-html/prog/progsu38.html#x45-430001.1.38

Regards,
Sven

Reply by email

Kjow
to Paul Ishenin: vinfo unit was attached with the mail. Yes. Paul Ishenin.

2010/7/23 Paul Ishenin :

Show quoted text 13 lines
23.07.2010 16:12, Kjow wrote: > > Thank you, but my Lazarus (r26732M) can't find vinfo unit. vinfo unit was attached with the mail. > Other question: Is this procedure multiplatform compatible? ( => ?Does > it work on Linux?) Yes. Best regards, Paul Ishenin.

Oops! :)
Thank you! In gmail, when there is a file attached, there isn't a great visibility.

Reply by email

waldo kitty
to Kjow: 2010/7/23 Paul Ishenin : Thank you, but my Lazarus (r26732M) can't find vinfo unit. Other…
Kjow wrote 11 lines
2010/7/23 Paul Ishenin: > 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): Thank you, but my Lazarus (r26732M) can't find vinfo unit.

did you miss the attachment(s)??

Reply by email

waldo kitty
to Sven Barth: Hi! Did you know about this: === program Foo; {$apptype console} begin Writeln({$I…
Sven Barth wrote 16 lines
Hi! Am 23.07.2010 00:58, schrieb waldo kitty: > on the surface, this would seem to be similar to the C style > preprocessor stuff that takes "macros" like __DATE__ and __TIME__ and > converts them to the current date and time and writes them into the > object code... i did something like this for TP6/BP6 way back in the > day... set those as consts in an include that was rewritten each time by > my preprocessor before the command line compiler was called... actually > using them (ie: forcing them to be included in the binary) required that > at least one const string be used in the execution of the program... > these didn't have to be used in the code but they were included such > that one could see them in the binary when it was viewed via a hex > editor/viewer... Did you know about this:

whoa! wow!! how about that! i'd have never thought to even try something like that... it looks the same as including environment variables in 4DOS/4OS2/4NT with the percents on both sides like that :) :) :)

i guess i'm going to have to figure out how to separate FPC from Lazarus so as to get a better base of FPC's offerings before attempting to dance the GUI dance... getting them in one package is nice except that one can get confused about what it available in Lazarus vs what is available in FPC...

i really do wish that the help files would come preinstalled in the available installation packages... installing on win and *nix leaves a lot to be desired as far as the built in F1 help stuff goes... especially when one has to go in and fill in the blanks with some unknown directory value(s) that are not readily apparent :? i won't even mention having a PDF of the documentation as i know that there's still work going on for the german language book that i hope will be released in english before too long...

thanks for sharing that :) if it were only that easy to grab other values like the compilation version number originally spoken of in this thread ;)

Show quoted text 32 lines
=== program Foo; {$apptype console} begin Writeln({$I %DATE%} + ' ' + {$ %TIME%}); Readln; end. === Output: 2010/07/23 10:13:40 === It's documented here: http://www.freepascal.org/docs-html/prog/progsu38.html#x45-430001.1.38 Regards, Sven -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Kjow
to waldo kitty: did you miss the attachment(s)??

2010/7/23 waldo kitty :

Show quoted text 18 lines
On 7/23/2010 04:12, Kjow wrote: > > 2010/7/23 Paul Ishenin: >> >> 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): > > Thank you, but my Lazarus (r26732M) can't find vinfo unit. did you miss the attachment(s)??

Yes, I missed.
But as already wrote, then I found it. ;)

Reply by email

Sven Barth
to waldo kitty: whoa! wow!! how about that! i'd have never thought to even try something like that... it…

Hi!

waldo kitty wrote
whoa! wow!! how about that! i'd have never thought to even try something like that... it looks the same as including environment variables in 4DOS/4OS2/4NT with the percents on both sides like that :) :) :)

It does not only look like such environment variables, you can also use them environment variables there :) (see the example at the bottom of the documentation link I sent you).

Show quoted text 5 lines
i guess i'm going to have to figure out how to separate FPC from Lazarus so as to get a better base of FPC's offerings before attempting to dance the GUI dance... getting them in one package is nice except that one can get confused about what it available in Lazarus vs what is available in FPC...

I don't believe that anyone knows everything the compiler can do (maybe Florian is the only exception). Even Jonas didn't know about the "cppclass" before he started to work on "objcclass".

Show quoted text 8 lines
i really do wish that the help files would come preinstalled in the available installation packages... installing on win and *nix leaves a lot to be desired as far as the built in F1 help stuff goes... especially when one has to go in and fill in the blanks with some unknown directory value(s) that are not readily apparent :? i won't even mention having a PDF of the documentation as i know that there's still work going on for the german language book that i hope will be released in english before too long...

But you won't find information like that about "{$I %XXX%}" by pressing F1 on an identifier. You need to read the documentation yourself or stumple upon a mailing list entry where this feature is mentioned (like what happened with me and the already mentioned "cppclass").

thanks for sharing that :) if it were only that easy to grab other values like the compilation version number originally spoken of in this thread ;)

You're welcome.
As Paul showed grabbing those version numbers is already rather easy now that FPC supports Windows-like resources on most targets.

Regards,
Sven

Reply by email