Micha Nelissen пишет:
Jouke Rensma wrote:
automatically. At this moment you have to arrange this by hand.
As said before I would first like to know:
- am I inventing a wheel?
- is somebody else working on this also? If yes, maybe we can cooperate???
- since this is very windows specific, should I continue anyway or maybe just forget about it?

If you think I should continue, then I have some problems I would to discuss, but first your ideas please.

I think you'll have to write/modify these things into a <projectname>.rc and then run windres to compile it to .res ? I think keeping the buildnumber in the project file and automatically incrementing it upon succesfull build isn't a big problem (Mattias usually does these kind of things in the IDE...) ?
Yes, this is a good idea.
I think this way is the same way that is used in Delphi. Also, as I see Lazarus stores this information in <projectname>.or file that is, IMHO, simple *.res file.

I have some small code that can extract that kind of information (version number) at runtime. Here it is

Procedure FillStrListWithFileVersionInfo;
var
  sAppExeName,sChapter:Array[0..256] of Char;
  iAppVerInfoSize,
  Len, i              :LongWord;
  sBuffer             :PChar;
  sValue              :PChar;
Begin
  sAppExeName    := Application.ExeName;
  iAppVerInfoSize:= GetFileVersionInfoSize(sAppExeName,iAppVerInfoSize);
  if iAppVerInfoSize > 0 then  begin
    sBuffer := AllocMem(iAppVerInfoSize);
    GetFileVersionInfo(sAppExeName, 0, iAppVerInfoSize, sBuffer);
    for i := 1 to InfoNum do Begin
      sChapter:='StringFileInfo\040904E4\' + InfoStr[i];
      if VerQueryValue(sBuffer, sChapter, sValue, Len) then
        AppVersionStrList.Add(InfoStr[i] + ' = ' + sValue);
    End;
    FreeMem(sBuffer, iAppVerInfoSize);
  end;
End;


It works both in Delphi and in Lazarus.

Regards. Alexey.

Reply via email to