Board index » delphi » How to read Version Information?

How to read Version Information?

Hi,

Does anyone knows how to read the Version Information build in an Delphi
3.0 application?

Thanks,

Paulo
--

               \\\|///
             \\  - -  //
              (  @ @  )
/-----------oOOo-(_)-oOOo------------------\
|                                          |
| Paulo Jorge Casteleiro Amaral            |
|                                          |
| INESC/UTC                                |
| email: Paulo.Ama...@inesc.pt             |
| Tel: +351 1 3100027/10                   |
|                                          |
| FCUL                                     |
| email: i17...@caravela.di.fc.ul.pt       |
| URL: http://caravela.di.fc.ul.pt/~i17125 |
\------------------------------------------/

--------------------------------------------------------
 If at first you don't succeed...lower your standards!
--------------------------------------------------------
 The biggest people with the biggest ideas can be shot
 down by the smallest people with the smallest minds.
  THINK BIG ANYWAY.
--------------------------------------------------------

 

Re:How to read Version Information?


Quote
In article <01bcb305$7c5317c0$3922c192@plutao> "Paulo Amaral" <pama...@burgau.inesc.pt> writes:
>Does anyone knows how to read the Version Information build in an Delphi
>3.0 application?

Search http://www.dejanews.com.  I published a source-code example to the net
a couple of months back in response to this very request.  It's even 16-32
bit.  Lifted straight from the ChimneySweep source code for the "about" box.

Re:How to read Version Information?


 $)CUse GetFileVersionInfo, GetFileVersionInfoSize, and VerQueryValue.
The following is an example.
Have a good day.

procedure TForm1.Button1Click(Sender: TObject);
type
  PTRANSARRAY = ^TTRANSARRAY;
  TTRANSARRAY = packed record
                  wLanguageID   : WORD;
                  wCharacterSet : WORD;
                end;
var
  lpstrFileName  : PChar;
  BuffSize       : DWORD;
  dwHandle       : Integer;
  vPtr           : PChar;
  lpFixedPointer : Pointer;
  dwFixedLength  : UINT;
  lpTransArray   : TTRANSARRAY;
  QueryString    : string;
begin
  lpstrFileName := 'C:\Program Files\Borland\Delphi 3\Bin\Delphi32.EXE';
  BuffSize := GetFileVersionInfoSize ( lpstrFileName, dwHandle );
  if BuffSize > 0
    then begin
           vPtr := StrAlloc ( BuffSize );
           GetFileVersionInfo ( lpstrFileName, dwHandle, BuffSize, vPtr );
           VerQueryValue ( vPtr,
                          '\VarFileInfo\Translation',
                          lpFixedPointer,
                          dwFixedLength );
           lpTransArray := PTRANSARRAY ( lpFixedPointer )^;
           QueryString := Format ( '\StringFileInfo\%s%s\FileVersion',
                         [ IntToHex ( lpTransArray.wLanguageID, 4 ),
                           IntToHex ( lpTransArray.wCharacterSet, 4 ) ] );
           VerQueryValue ( vPtr,
                           PChar ( QueryString ),
                           lpFixedPointer,
                           dwFixedLength );
           ShowMessage ( StrPas ( PChar ( lpFixedPointer ) ) );
           StrDispose ( vPtr );
         end;
end;

Paulo Amaral <pama...@burgau.inesc.pt> @L ( 0! )
<01bcb305$7c5317c0$3922c192@plutao>  1b;g?!<-   @[<:G_=@4O4Y ...

Quote
> Hi,

> Does anyone knows how to read the Version Information build in an Delphi
> 3.0 application?

> Thanks,

> Paulo
> --

>                \\\|///
>              \\  - -  //
>               (  @ @  )
> /-----------oOOo-(_)-oOOo------------------\
> |                                          |
> | Paulo Jorge Casteleiro Amaral            |
> |                                          |
> | INESC/UTC                                |
> | email: Paulo.Ama...@inesc.pt             |
> | Tel: +351 1 3100027/10                   |
> |                                          |
> | FCUL                                     |
> | email: i17...@caravela.di.fc.ul.pt       |
> | URL: http://caravela.di.fc.ul.pt/~i17125 |
> \------------------------------------------/

> --------------------------------------------------------
>  If at first you don't succeed...lower your standards!
> --------------------------------------------------------
>  The biggest people with the biggest ideas can be shot
>  down by the smallest people with the smallest minds.
>   THINK BIG ANYWAY.
> --------------------------------------------------------

Other Threads