John,
  This will get the version number as an int64 which you can use for
comparisons.  I guess you can modify it to retrieve the 4 individual 16 bit
entries that go between the dots.

function GetFileVersion(const Filename: string): int64;
var
  VersionInfoSize               : integer;
  VersionInfoHandle   : DWORD;
   VersionInfo  : string;
    szName                : array[0..255] of char;
    FixedFileInfo   : PVSFixedFileInfo;
                BufferLen                       : UINT;
begin
  result := 0;
  VersionInfoSize := GetFileVersionInfoSize(
                                pChar( Filename),
                                VersionInfoHandle );
  if VersionInfoSize > 0 then
    begin
    SetLength( VersionInfo, VersionInfoSize );
    BufferLen := sizeof(TVSFixedFileInfo);
    if GetFileVersionInfo( pChar( FileName),
                VersionInfoHandle,
                VersionInfoSize,
                pChar( VersionInfo )) then
      if VerQueryValue( pChar( VersionInfo ),
                        StrPCopy(szName,'\'),
                        pointer(FixedFileInfo),
                        BufferLen) and (BufferLen > 0) then
        begin
        result := FixedFileInfo.dwFileVersionMS;
        result := result shl 32;
        result := result + FixedFileInfo.dwFileVersionLS;
        end;
    end;
end;

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of John Bird
Sent: Friday, 3 November 2006 11:50 a.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] Version number

How do I get the current program version number from inside a program at
runtime (the one that can be set to auto-increment in the builds in Options)

John


_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi


_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to