获取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;
欢迎关注我,一起进步!扫描下方二维码即可加我