To get the file version call the following with Value = 'FileVersion'
Other info available includes 'CompanyName', 
'LegalCopyright','ProductName','ProductVersion',....

HTH

Stephen

function FileInformation(FileName, Value: string): string;
var
  Data: PChar;
  BufSize, VerHndl: DWORD;
  Buf: Pointer;
  Len: UINT;
  LangCharSetWord0, LangCharSetWord1: ^Word;
  LangCharSet: string;
begin
  Result := '';
  BufSize := GetFileVersionInfoSize(PChar(FileName), VerHndl);
  if BufSize > 0 then
  begin
    Data := StrAlloc(BufSize + 1);
    try
      if GetFileVersionInfo(PChar(FileName), VerHndl, BufSize, Data) then
      begin
        if VerQueryValue(Data, '\VarFileInfo\Translation', Buf, Len) then
        begin
          LangCharSetWord0 := @Buf^;
          Buf := Pointer(Longint(Buf) + 2);
          LangCharSetWord1 := @Buf^;
          LangCharSet := IntToHex(LangCharSetWord0^, 4)
            + IntToHex(LangCharSetWord1^, 4);
          if VerQueryValue(Data, PChar('\StringFileInfo\' + LangCharSet
            + '\' + Value), Buf, Len) then
            Result := string(PChar(Buf));
        end;
      end;
    finally
      StrDispose(Data);
    end;
  end;
end;
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to