1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Function RenvoiVersion(NomAppli : String ):String;
var
FileName: string;
InfoSize, Wnd: DWORD;
VerBuf: Pointer;
FI: PVSFixedFileInfo;
VerSize: DWORD;
begin
Result := '';
FileName := NomAppli;
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
Result := InttoStr(StrToInt(Copy(IntToHex(FI.dwFileVersionMS,8),1,4)));
Result := Result +'.'+InttoStr(StrToInt(Copy(IntToHex(FI.dwFileVersionMS,8),5,4)));
Result := Result + InttoStr(StrToInt(Copy(IntToHex(FI.dwFileVersionLS,8),1,4)));
end;
finally
FreeMem(VerBuf);
end;
end;
end; |
Partager