[DUG] Version number
Conor Boyd
Conor.Boyd at trimble.co.nz
Fri Nov 3 12:16:39 NZDT 2006
Here's a function I use:
function GetProgramVersion(const path: String): String;
var
nZero,nSize : DWORD;
lpData : pointer;
p : pointer;
begin
Result := 'n/a';
nSize := GetFileVersionInfoSize(pChar(path), nZero);
if nSize > 0 then
begin
GetMem(lpData, nSize);
try
if GetFileVersionInfo(pChar(path), 0, nSize, lpData) then
if VerQueryValue(lpData, '\', p, nZero) then
Result := IntToStr(tVSFIXEDFILEINFO(p^).dwFileVersionMS shr
16) + '.' +
IntToStr(tVSFIXEDFILEINFO(p^).dwFileVersionMS and
$FFFF) + '.' +
IntToStr(tVSFIXEDFILEINFO(p^).dwFileVersionLS shr
16) + '.' +
IntToStr(tVSFIXEDFILEINFO(p^).dwFileVersionLS and
$FFFF);
finally
FreeMem(lpData, nSize);
end;
end;
end;
If you want the version of the currently running program, you can just
call it with GetProgramVersion(ParamStr(0));
HTH,
Conor
-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of John Bird
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)
More information about the Delphi
mailing list