Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Cargar Version en el Caption del Form (https://www.clubdelphi.com/foros/showthread.php?t=72937)

Paulao 21-03-2011 13:39:51

Cargar Version en el Caption del Form
 
Como hago para cargar la version en el Caption del Form que yo configure en Project Options > Resource Compiler > Version Info?

rgstuamigo 21-03-2011 14:00:43

Mira aquí...;)
Saludos...:)

rastafarey 22-03-2011 02:04:42

Resp
 
haber si esto te sirve.
Código Delphi [-]
unit AplicacionInfo;

interface
uses Windows, Classes, SysUtils;

type
  TVersionInfo = class(TObject)
  private
    FData: Pointer;
    FSize: Cardinal;
    FNombreCompania: string;
    FDescripcionDelArchivo: string;
    FVersionDelArchivo: string;
    FNombreInterno: string;
    FDerechosDeCopiado: string;
    FMarcasRegistradas: string;
    FNombreOriginalDelArchivo: string;
    FNombreDelProducto: string;
    FVersionDelProducto: string;
    FComentarios: string;
    FVersionInterna: Integer;
  public
    constructor Create(FileName: string); Overload;
    constructor Create; Overload;
    destructor Destroy; override;
    property NombreCompania: string read FNombreCompania;
    property DescripcionDelArchivo: string read FDescripcionDelArchivo;
    property VersionDelArchivo: string read FVersionDelArchivo;
    property NombreInterno: string read FNombreInterno;
    property DerechosDeCopiado: string read FDerechosDeCopiado;
    property MarcasRegistradas: string read FMarcasRegistradas;
    property NombreOriginalDelArchivo: string read FNombreOriginalDelArchivo;
    property NombreDelProducto: string read FNombreDelProducto;
    property VersionDelProducto: string read FVersionDelProducto;
    property Comentarios: string read FComentarios;
    property VersionInterna: Integer read FVersionInterna;
  end;

implementation
{ TVersionInfo }

constructor TVersionInfo.Create(FileName: string);
var
  sz, lpHandle, tbl: Cardinal;
  lpBuffer: Pointer;
  str: PChar;
  strtbl: string;
  int: PInteger;
  hiW, loW: Word;
  Function Leer(Const pcValor: String): String;
  Begin
    VerQueryValue(FData, PChar('\\StringFileInfo\' + strtbl + pcValor), lpBuffer, sz);
    str := lpBuffer;
    Result := str;
  End;
begin
  inherited Create;
  FSize := GetFileVersionInfoSize(PChar(FileName), lpHandle);
  FData := AllocMem(FSize);
  GetFileVersionInfo(PChar(FileName), lpHandle, FSize, FData);

  VerQueryValue(FData, '\\VarFileInfo\Translation', lpBuffer, sz);
  int := lpBuffer;
  hiW := HiWord(int^);
  loW := LoWord(int^);
  tbl := (loW shl 16) or hiW;
  strtbl := Format('%x', [tbl]);
  if Length(strtbl) < 8 then
    strtbl := '0' + strtbl;

  FNombreCompania := Leer('\CompanyName');
  FDescripcionDelArchivo := Leer('\FileDescription');
  FVersionDelArchivo := Leer('\FileVersion');
  FNombreInterno := Leer('\InternalName');
  FDerechosDeCopiado := Leer('\LegalCopyright');
  FMarcasRegistradas := Leer('\LegalTrademarks');
  FNombreOriginalDelArchivo := Leer('\OriginalFilename');
  FNombreDelProducto := Leer('\ProductName');
  FVersionDelProducto := Leer('\ProductVersion');
  FComentarios := Leer('\Comments');
  FVersionInterna := StrToInt(Leer('\VersionInterna'));
end;

constructor TVersionInfo.Create;
begin
  Create(ParamStr(0));
end;

destructor TVersionInfo.Destroy;
begin
  FreeMem(FData);
  inherited;
end;

end.


La franja horaria es GMT +2. Ahora son las 03:20:00.

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