Odczytać wersję programu

0

How to extract exe FileVersion...?

0

Wyciągnij to zasobów pliku EXE.

0

function TFormAbout.GetVersionString(VerStr : String) : String;
{ This is the function to get the FileVersionInfo }
var
FileName: String;
Size : DWORD;
Handle : DWORD;
Len : UINT;
Buffer : PChar;
Value : PChar;
TransNo : PLongInt;
SFInfo : String;
begin
Result := '';
FileName := Application.ExeName;
Size := GetFileVersionInfoSize(PChar(FileName), Handle);
if Size > 0 then begin
Buffer := AllocMem(Size);
try
GetFileVersionInfo(PChar(FileName), 0, Size, Buffer);
VerQueryValue(Buffer, PChar('VarFileInfo\Translation'),
Pointer(TransNo), Len);
SFInfo := Format('%s%.4x%.4x%s%s%', ['StringFileInfo',
LoWord(TransNo), HiWord(Transno), '', VerStr]);
if VerQueryValue(Buffer, PChar(SFInfo),
Pointer(Value), Len) then
Result := Value;
finally
{ always release memory }
if Assigned(Buffer) then
FreeMem(Buffer, Size);
end;
end;
end;
(*****
How to use GetVersionString function to extract File Version Info
MyCompanyName := GetVersionString('CompanyName');
:= GetVersionString('FileDescription');
:= GetVersionString('FileVersion');

1 użytkowników online, w tym zalogowanych: 0, gości: 1