I need to read the version number of the currently active project in
my design time package. For this I have written the following code:

function TSettings.GetVersion: String;
var
  Res: TAbstractProjectResources;
  ResVer: TProjectVersionInfo;
begin
  Res := LazarusIDE.ActiveProject.Resources as TAbstractProjectResources;
  ResVer := Res.Resource[TProjectVersionInfo] as TProjectVersionInfo;
  Result := Format('%d.%d.%d.%d',  [ResVer.MajorVersionNr,
                                    ResVer.MinorVersionNr,
                                    ResVer.RevisionNr,
                                    ResVer.BuildNr]);
end;

It needs the unit W32VersionInfo which is in the package LCL. Now I
have noticed that when adding LCL as a depedency to my package I
cannot compile the IDE from a clean directory, obviously when using
IDE while IDE is not yet compiled seems to be not such a good idea. Is
there a better way to get the version number? I could not find any
other place to access it.

Bernd

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to