Browse Source

* Resources example

git-svn-id: trunk@23319 -
michael 12 years ago
parent
commit
51cce629e9
3 changed files with 45 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 43 0
      packages/fcl-base/examples/testver.pp
  3. BIN
      packages/fcl-base/examples/testver.res

+ 2 - 0
.gitattributes

@@ -1852,6 +1852,8 @@ packages/fcl-base/examples/testsres.pp svneol=native#text/plain
 packages/fcl-base/examples/testtimer.pp svneol=native#text/plain
 packages/fcl-base/examples/testtimer.pp svneol=native#text/plain
 packages/fcl-base/examples/testunzip.pp svneol=native#text/plain
 packages/fcl-base/examples/testunzip.pp svneol=native#text/plain
 packages/fcl-base/examples/testur.pp svneol=native#text/plain
 packages/fcl-base/examples/testur.pp svneol=native#text/plain
+packages/fcl-base/examples/testver.pp svneol=native#text/plain
+packages/fcl-base/examples/testver.res -text
 packages/fcl-base/examples/testweb.pp svneol=native#text/plain
 packages/fcl-base/examples/testweb.pp svneol=native#text/plain
 packages/fcl-base/examples/testz.pp svneol=native#text/plain
 packages/fcl-base/examples/testz.pp svneol=native#text/plain
 packages/fcl-base/examples/testz2.pp svneol=native#text/plain
 packages/fcl-base/examples/testz2.pp svneol=native#text/plain

+ 43 - 0
packages/fcl-base/examples/testver.pp

@@ -0,0 +1,43 @@
+program testver;
+
+{$mode objfpc}{$H+}
+
+uses
+  Classes, fileinfo
+  { you can add units after this };
+
+{$R *.res}
+
+Var
+  I : Integer;
+
+  PV : TProgramVersion;
+  VQ : TVersionQuad;
+
+begin
+  With TFileVersionInfo.Create(Nil) do
+    try
+      FileName:=ParamStr(0);
+      Translation:='123';
+      Filter.Add('Fileversion');
+      Enabled:=True;
+      Writeln('Using translation : ',TRanslation);
+      For I:=0 to VersionStrings.Count-1 do
+        Writeln(VersionStrings[i]);
+    Finally
+      Free;
+    end;
+  if GetProgramVersion(VQ) then
+    begin
+    Writeln('Version: ',VQ[1],'.',VQ[2],'.',VQ[3],' build: ',VQ[4]);
+    Writeln('Version (short) : ',versionQuadToStr(VQ));
+    Writeln('Compare to 1.0 : ',CompareVersionQuads(VQ,StrToVersionQuad('1.0.0.0')));
+    end;
+  if GetProgramVersion(PV) then
+    begin
+    Writeln('Version: ',PV.Major,'.',PV.Minor,'.',PV.Revision,' build: ',PV.Build);
+    Writeln('Version (short) : ',ProgramVersionToStr(PV));
+    Writeln('Compare to 1.0 : ',CompareProgramVersion(VQ,StrToVersionQuad('1.0.0.0')));
+    end;
+end.
+

BIN
packages/fcl-base/examples/testver.res