我有一个应用程序,它使用DLL来生成fastReports文件。
当我需要更改报告数据结构时,我只更改此DLL并将其分发给应用程序的所有用户。我怎么能保证所有人在开始之前都有最新的版本?
如何从DLL文件中生成/提取此信息。
发布于 2011-04-20 05:03:20
此函数将以字符串形式获取文件版本:
function FileVersionGet( const sgFileName : string ) : string;
var infoSize: DWORD;
var verBuf: pointer;
var verSize: UINT;
var wnd: UINT;
var FixedFileInfo : PVSFixedFileInfo;
begin
infoSize := GetFileVersioninfoSize(PChar(sgFileName), wnd);
result := '';
if infoSize <> 0 then
begin
GetMem(verBuf, infoSize);
try
if GetFileVersionInfo(PChar(sgFileName), wnd, infoSize, verBuf) then
begin
VerQueryValue(verBuf, '\', Pointer(FixedFileInfo), verSize);
result := IntToStr(FixedFileInfo.dwFileVersionMS div $10000) + '.' +
IntToStr(FixedFileInfo.dwFileVersionMS and $0FFFF) + '.' +
IntToStr(FixedFileInfo.dwFileVersionLS div $10000) + '.' +
IntToStr(FixedFileInfo.dwFileVersionLS and $0FFFF);
end;
finally
FreeMem(verBuf);
end;
end;
end;发布于 2011-04-20 09:34:49
获取Dll版本:
function GetDllVersion: string; //Run in dll project
var
fn: string;
begin
fn := GetModuleName(HInstance);
Result := FileVersionGet(fn); // use Matthias's function
end;发布于 2011-04-20 04:56:20
使用SysUtils.GetFileVersion()
获取文件版本需要预先设置文件版本。
https://stackoverflow.com/questions/5722378
复制相似问题