PDA

Ver la Versión Completa : Obtener la versión del ejecutable de una aplicación


dec
07-06-2006, 20:30:23
Función que nos devuelve en forma de cadena de caracteres la versión del archivo ejecutable de una determinada aplicación:


uses
Windows, SysUtils;

function VersionExe(const ruta: string) : string;
var
Pt, Pt2: Pointer;
Size, Size2: DWord;
begin
Result := '';
if not FileExists(ruta) then Exit;
Size := GetFileVersionInfoSize(PChar(ruta), Size2);
if (Size > 0) then begin
GetMem(Pt, Size);
try
GetFileVersionInfo(PChar(ruta), 0, Size, Pt);
VerQueryValue (Pt, '\', Pt2, Size2);
with TVSFixedFileInfo (Pt2^) do begin
Result :=
IntToStr(HiWord(dwFileVersionMS))+'.'+
IntToStr(LoWord(dwFileVersionMS))+'.'+
IntToStr(HiWord(dwFileVersionLS))+'.'+
IntToStr(LoWord(dwFileVersionLS));
end;
finally
FreeMem(Pt);
end;
end;
end;

Kipow
20-02-2009, 09:30:31
Excelente, precisamente andaba buscando esta funcion. muy agradecido.