Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Obtener la versión del ejecutable de una aplicación (https://www.clubdelphi.com/foros/showthread.php?t=80429)

dec 07-06-2006 20:30:23

Obtener la versión del ejecutable de una aplicación
 
Función que nos devuelve en forma de cadena de caracteres la versión del archivo ejecutable de una determinada aplicación:

Código Delphi [-]
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.


La franja horaria es GMT +2. Ahora son las 15:24:49.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi