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

Mailing lists / lazarus / 2010-07
18 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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
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
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.
On Thu, 22 Jul 2010 23:42:41 +0200 No. Unless you write a tool/script that is called…
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...
I think Kjow is asking about the auto increment build number feature which increases the…
2010/7/23 Paul Ishenin :
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
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>
Maybe it should be added somewhere in the documentation? including the requirements.
Mattias
This constanst is stored as a resource of your application. You can read it by accessing…
2010/7/23 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
On Fri, 23 Jul 2010 15:59:00 +0800 Maybe it should be added somewhere in the…
Mattias Gaertner wroteMaybe it should be added somewhere in the documentation? including the requirements.
I wish to add it somewhere to fpc but don't know the right place.
Btw, is it possible to add a unit to the documentation?
Best regards,
Paul Ishenin.
2010/7/23 Paul Ishenin : Thank you, but my Lazarus (r26732M) can't find vinfo unit. Other…
Kjow wroteThank 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.
on the surface, this would seem to be similar to the C style preprocessor stuff that…
Hi!
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
I wish to add it somewhere to fpc but don't know the right place. Btw, is it possible to…
For FCL units: ask Michael.
Mattias
vinfo unit was attached with the mail. Yes. Paul Ishenin.
2010/7/23 Paul Ishenin :
Oops! :)
Thank you! In gmail, when there is a file attached, there isn't a great visibility.
2010/7/23 Paul Ishenin : Thank you, but my Lazarus (r26732M) can't find vinfo unit. Other…
did you miss the attachment(s)??
Hi! Did you know about this: === program Foo; {$apptype console} begin Writeln({$I…
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 ;)
did you miss the attachment(s)??
2010/7/23 waldo kitty :
Yes, I missed.
But as already wrote, then I found it. ;)
whoa! wow!! how about that! i'd have never thought to even try something like that... it…
Hi!
waldo kitty wrotewhoa! 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).
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".
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
2010/7/23 waldo kitty : Yes, I missed. But as already wrote, then I found it. ;)
yes, so i saw but it was too late to retract my sent post to the list :lol: