Ver Mensaje Individual
  #12  
Antiguo 08-10-2005
CRIS CRIS is offline
Miembro
 
Registrado: jul 2003
Posts: 63
Reputación: 21
CRIS Va por buen camino
Lo tengo casi solucionado el problema es que me da la descripcion y demas datos del archivo pero solo del archivo que lleva este codigo, no se como decirle una ruta para que lea los datos del archivo que yo quiera.

Código Delphi [-]
function  GetAppInfo(De:string):string;

  {Se pueden pedir los siguientes datos:
     CompanyName
     FileDescription
     FileVersion
     InternalName
     LegalCopyright
     OriginalFilename
     ProductName
     ProductVersion
  }

  type
    PaLeerBuffer = array [0..MAX_PATH] of char;

  var
   Size, Size2 : DWord;
   Pt, Pt2     : Pointer;
   Idioma      : string;

   begin
     Result:='';
     Size := GetFileVersionInfoSize(PChar (Application.Exename), Size2);
     if Size > 0 then
     begin
       GetMem (Pt, Size);
       GetFileVersionInfo (PChar (ParamStr (0)), 0, Size, Pt);
       {Obtenemos la cadena de translacion, requerida para obtener el resto
       de datos del Versioninfo}
       VerQueryValue( Pt, '\VarFileInfo\Translation',Pt2, Size2);
       Idioma:=IntToHex( DWord(Pt2^) ,8 );
       {Le damos la vuelta (Es windows, que quieres...}
       Idioma:=Copy(Idioma,5,4)+Copy(Idioma,1,4);

       {Pedimos la info requerida...}
       VerQueryValue( Pt,
                      Pchar('\StringFileInfo\'+
                      Idioma+'\'+
                      De),
                      Pt2, Size2);
       if Size2 > 0 then
       begin
         {Y la devolvemos}
         Result:=Copy(PaLeerBuffer(Pt2^),1,Size2);
       end else
         raise Exception.Create( 'No existe esa informacion en este ejecutable'+
                                 #13+
                                 'There are not this info in this executable');
       FreeMem (Pt);
     end else
       raise exception.Create ( 'Lo siento, no hay VersionInfo disponible '+
                                'en este ejecutable.'+#13+
                                'Sorry there are not VersionInfo available'+
                                'in this executable.');
   end;
{$R *.dfm}

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
label1.Caption := GetAppInfo ('FileDescription');
end;


Sabeis como y donde poner la ruta del archivo??

Salu2.CRIS.
Responder Con Cita