Lazarus 获取程序版本号
在Uses处加上fileinfo,如下:
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, fileinfo;
创建一个获取版本号的函数
function GetAppVersion: String;
var
AppVersion: TFileVersionInfo;
begin
AppVersion:= TFileVersionInfo.Create(nil);
try
AppVersion.ReadFileInfo;
Result := AppVersion.VersionStrings.Values['FileVersion'];
finally
FileVer.Free;
end;
end;
在需要的地方调用以上函数,读取程序版本号,如:
Label1.Caption := ‘程序版本:’ + GetAppVersion;