返回文件版本信息字符串函数
function GetFileVersionString(FileName: string): string;
var
InfoSize, Wnd: DWORD;
VerBuf: Pointer;
FI: PVSFixedFileInfo;
VerSize: DWORD;
begin
Result := '';
InfoSize := GetFileVersionInfoSize(PChar(FileName), Wnd);
if InfoSize <> 0 then
begin
GetMem(VerBuf, InfoSize);
try
if GetFileVersionInfo(PChar(FileName), Wnd, InfoSize, VerBuf) then
if VerQueryValue(VerBuf, '\', Pointer(FI), VerSize) then
begin
// FI.dwFileVersionMS;
Result := Format('%d.%d.%d Build %d',
[HiWord(FI.dwFileVersionMS),
LoWord(FI.dwFileVersionMS),
HIWORD(FI.dwFileVersionLS),
LoWord(FI.dwFileVersionLS)]);
if (FI^.dwFileFlags and VS_FF_PRERELEASE) > 0 then
Result := Result + ' Beta';
end;
finally
FreeMem(VerBuf);
end;
end;
end;