Witajcie
Mam taki problem. Tan kodzik powinien pokazać wersje podanego pliku, tymczasem nie chce działać jak należy. Może ktoś wie jak go poprawić?
const
InfoNum = 10;
InfoStr: array[1..InfoNum] of string = ('CompanyName', 'FileDescription', 'FileVersion', 'InternalName', 'LegalCopyright', 'LegalTradeMarks', 'OriginalFileName', 'ProductName', 'ProductVersion', 'Comments');
var
N, Len, I : DWORD;
Buf : PChar;
Value : PChar;
begin
N := GetfileVersion('C:xxxxx.dll');
if N > 0 then
begin
Buf := AllocMem(N);
Memo1.Lines.Add('VersionInfoSize = ' + IntToStr(N));
GetfileVersion(PChar('C:xxxxx.dll'));
for I := 1 to InfoNum do if VerQueryValue(Buf, PChar('StringFileInfo40904E4' + InfoStr[I]), Pointer(Value), Len) then Memo1.Lines.Add(InfoStr[I] + ' = ' + Value);
FreeMem(Buf, N);
end
else Memo1.Lines.Add('No version information found');
end;