[Lazarus] Program version
Sven Barth
pascaldragon at googlemail.com
Wed Nov 6 15:51:23 CET 2013
Am 06.11.2013 15:39, schrieb Antonio Fortuny:
>
> Le 06/11/2013 14:41, Anton Kavalenka a écrit :
>> The unit versionresource is part of package fcl-res
> I already use it for Linux with a Linux executable file
>>
>> Unit allow x-platform version resource extraction and parsing.
>> rsrc:=TVersionResource.Create;
>> Stream := TResourceStream.CreateFromID(*hMod*, 1, PChar(RT_VERSION));
> What's *hMod *stands for ? Looks like a pointer of so (PtrUint)
>> rsrc.SetCustomRawDataStream(Stream);
>> with res do
>> case it of
>> vsFileVersion:
>> Result:=format('%d.%d.%d.%d',[FileVersion[0],FileVersion[1],FileVersion[2],FileVersion[3]]);
>> vsProductVersion:
>> Result:=format('%d.%d.%d.%d',[ProductVersion[0],ProductVersion[1],ProductVersion[2],ProductVersion[3]]);
>> end;
>>
Hmm... nice... we already seem to have cross platform support :)
You could try something like this (untested, just made up from the code
I see in fcl-res!):
=== code begin ===
uses
resource, winpeimagereader, elfreader, versionresource;
var
res: TResources;
abstrres: TAbstractResource;
begin
res := TResources.Create;
try
res.LoadFromFile('whatever.exe'); // or 'whatever' for ELF files
abstrres := res.Find(RT_VERSION, 1);
if abstrres is TVersionResource then
...
finally
res.Free;
end;
end.
=== code end ===
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131106/c9fbd54a/attachment-0003.html>
More information about the Lazarus
mailing list