Lazarus examples folder has an application ResExplorer made by Alexey Lagunov. It does not work well, images and other resource contents are not shown. Only the resource name shows correctly.
It uses FPC resource classes. How to use them properly? I am testing now with FPC trunk but 2.6.4 works the same way.
Simplified code when a Windows executable is read :
Reader:=TWinPEImageResourceReader.Create;
Res:=TResources.Create;
Res.LoadFromFile(AFileName, Reader);The items (TAbstractResource) of "Res" are stored in a TreeView and later shown when nodes are clicked :
var
ResItem: TAbstractResource;...
if ResItem is TVersionResource then
LoadVersionResource(ResItem as TVersionResource)
else
if ResItem is TBitmapResource then
LoadBitmapResource(ResItem as TBitmapResource)
else
if ResItem is TGroupIconResource then
LoadGroupIconResource(ResItem as TGroupIconResource)The problem is that TBitmapResource never happens, although most of the resources contain images.
ResItem is TGenericResource then.
LoadGroupIconResource does happen but viewing it is not implemented. TVersionResource is the only one that really shows.
I have an idea to make a proper resource manager application supporting reading, writing and modifying both FPC *.res and the old Lazarus *.lrs resources. This ResExplorer would be a good starting point if only it worked.
Is there such code already somewhere? I don't want to do duplicate work.
Regards,
Juha
