unit UVersionInfo;
interface
uses Windows, SysUtils;
function GetVersionValue(FileName,QueryName:string):String;
implementation
function GetVersionValue(FileName,QueryName:string):String;
var
InfoSize, Wnd: DWORD;
VerBuf: Pointer;
szName: array[0..255] of Char;
Value: Pointer;
Len: UINT;
TransString:string;
begin
InfoSize := GetFileVersionInfoSize(PChar(FileName), Wnd);
if InfoSize <> 0 then
begin
GetMem(VerBuf, InfoSize);
try
if GetFileVersionInfo(PChar(FileName), Wnd, InfoSize, VerBuf) then
begin
Value :=nil;
VerQueryValue(VerBuf, 'VarFileInfoTranslation', Value, Len);
if Value <> nil then
TransString := IntToHex(MakeLong(HiWord(Longint(Value^)), LoWord(Longint(Value^))), 8);
Result := '';
StrPCopy(szName, 'StringFileInfo'+Transstring+''+QueryName);
if VerQueryValue(VerBuf, szName, Value, Len) then
Result := StrPas(PChar(Value));
end;
finally
FreeMem(VerBuf);
end;
end;
end;
end.