{$DEFINE Delphi3Below}
{$IFDEF VER130} //Delphi 5
{$UNDEF Delphi3Below}
{$ELSE}
{$IFDEF VER120} //Delphi 4
{$UNDEF Delphi3Below}
{$ENDIF}
{$ENDIF}
type
TFileVersionInfo = record
fCompanyName,
fFileDescription,
fFileVersion,
fInternalName,
fLegalCopyRight,
fLegalTradeMark,
fOriginalFileName,
fProductName,
fProductVersion,
fComments: string;
end;
var
FileVersionInfo: TFileVersionInfo;
procedure GetAppVersionInfo(sAppName
var
VerSize: integer;
VerBuf: PChar;
VerBufValue: pointer;
{$IFDEF Delphi3Below}
VerHandle: integer;
VerBufLen: integer;
{$ELSE}
VerHandle: cardinal;
VerBufLen: cardinal;
{$ENDIF}
VerKey: string;
function GetInfo(ThisKey: string): string;
begin
Result := '';
VerKey := '\StringFileInfo\' + IntToHex(loword(integer(Ve
IntToHex(hiword(integer(Ve
if VerQueryValue(VerBuf, PChar(VerKey), VerBufValue, VerBufLen) then
Result := StrPas(VerBufValue);
end;
function QueryValue(ThisValue: string): string;
begin
Result := '';
if GetFileVersionInfo(PChar(s
VerQueryValue(VerBuf, '\VarFileInfo\Translation'
Result := GetInfo(ThisValue);
end;
begin
if sAppNamePath = '' then
sAppNamePath := Application.ExeName;
VerSize := GetFileVersionInfoSize(PCh
VerBuf := AllocMem(VerSize);
try
FileVersionInfo.fCompanyNa
FileVersionInfo.fFileDescr
FileVersionInfo.fFileVersi
FileVersionInfo.fInternalN
FileVersionInfo.fLegalCopy
FileVersionInfo.fLegalTrad
FileVersionInfo.fOriginalF
FileVersionInfo.fProductNa
FileVersionInfo.fProductVe
FileVersionInfo.fComments := QueryValue('Comments');
finally
FreeMem(VerBuf, VerSize);
end;
end;
...and now:
GetAppVersionInfo(Applicat
Memo1.Lines.Add(FileVersio
for example :-)
Have fun!
Main Topics
Browse All Topics





by: VGRPosted on 2003-06-15 at 01:56:58ID: 8726386
in here : ar(S), n);
n := GetFileVersionInfoSize(PCh
are you sure you don't have to pass a non-zero value in the argument n ? The size of the buffer available to GetFile...() for example ? It would then be length(S);
sorry, no time to check my documentation
regards