获取EXe版本信息
function GetVersionString(FileName: string): string;
var
VerInfoSize: DWORD;
VerInfo: Pointer;
VerValueSize: DWORD;
Dummy: DWORD;
VerValue: PVSFixedFileInfo;
begin
Result := '';
VerInfoSize := GetFileVersionInfoSize(PChar(FileName), Dummy);
if VerInfoSize = 0 then Exit;
GetMem(VerInfo, VerInfoSize);
GetFileVersionInfo(PChar(FileName), 0, VerInfoSize, VerInfo);
VerQueryValue(VerInfo, '\', Pointer(VerValue), VerValueSize);
Result := IntToStr(VerValue^.dwFileVersionMS shr 16) + '.' +
IntToStr(VerValue^.dwFileVersionMS and $FFFF) + '.' +
IntToStr(VerValue^.dwFileVersionLS shr 16) + '.' +
IntToStr(VerValue^.dwFileVersionLS and $FFFF);
FreeMem(VerInfo);
end;
欢迎关注我,一起进步!扫描下方二维码即可加我
![](https://images.cnblogs.com/cnblogs_com/FKdelphi/1101510/o_200417075318%E5%8A%A0%E6%88%91QQ.jpg)
![](https://images.cnblogs.com/cnblogs_com/FKdelphi/1101510/o_200417080925%E5%8A%A0%E6%88%91%E5%BE%AE%E4%BF%A1.jpg)