[DUG] Version number
John Bird
johnkbird at paradise.net.nz
Fri Nov 3 15:28:58 NZDT 2006
Thanks guys - no wonder I was having the feeling this information was a bit
out of sight....
This was useful - also cos I found out the list hasn't been working for a
few days (sent this a few days ago originally and it went nowhere) - so any
other posts others have made also might need resending....
John
-----Original Message-----
From: Trevor Jones [mailto:trevorj at ihug.co.nz]
Sent: Friday, 3 November 2006 1:58 p.m.
To: johnkbird at paradise.net.nz; 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Version number
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: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] 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
Delphi at ns3.123.co.nz http://ns3.123.co.nz/mailman/listinfo/delphi
__________ NOD32 1.1461 (20060329) Information __________
This message was checked by NOD32 antivirus system. http://www.eset.com
More information about the Delphi
mailing list