mirror of
https://github.com/fast4x/datalock.git
synced 2025-06-05 21:49:16 +02:00
Initial Commit
This commit is contained in:
46
getvers_simple_win.pas
Normal file
46
getvers_simple_win.pas
Normal file
@ -0,0 +1,46 @@
|
||||
unit getvers_simple_win;
|
||||
|
||||
{$mode objfpc} {$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileInfo;
|
||||
|
||||
type
|
||||
GetFile = String;
|
||||
|
||||
Function GetVersionSimpleWin (Var GetFile : String): String;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
Function GetVersionSimpleWin (Var GetFile : String): String;
|
||||
var xinfo: tfileversioninfo;
|
||||
r:word;
|
||||
txt:string;
|
||||
begin
|
||||
if GetFile='' then GetFile:=Paramstr(0);
|
||||
xinfo := TFileVersionInfo.Create(nil);
|
||||
xinfo.fileName:=GetFile;
|
||||
xinfo.ReadFileInfo;
|
||||
// result:= xinfo.VersionStrings[4]; // fileversion
|
||||
// txt:=xinfo.VersionStrings[4];
|
||||
// result:= rightstr(txt,length(txt)-12);
|
||||
|
||||
|
||||
for r:=0 to xinfo.VersionStrings.Count-1 do begin
|
||||
// if ansipos('fileversion',lowercase(xinfo.VersionStrings[r])) > -1 then begin
|
||||
if copy(lowercase(xinfo.VersionStrings[r]),0,11)='fileversion' then begin
|
||||
txt:=xinfo.VersionStrings[r];
|
||||
result:=rightstr(txt,length(txt)-12);
|
||||
// break;
|
||||
// result:='trovato in item '+inttostr(r);
|
||||
end;
|
||||
end;
|
||||
|
||||
//result:='';
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user