There is a package of components *.bpk . *.bpk . In it, I implement my custom components. In one of them I need to use the *.png image from the rc file. Here are its contents:

 INFO RCDATA info.png DELETE RCDATA delete.png 

I compile in ChartIcon.res and try to connect it to the package project. The resource locker shows that resources are present:

  package SpComponents; {$R ChartIcon.res}` ... ... .. 

In the module where the component is defined, I try to load the resource:

 FInfoButton.Glyph.LoadFromResourceName(HInstance, 'INFO'); 

But it gives an error that the resource is not found. How to load the resource in the package?

    1 answer 1

    See the FInfoButton.Glyph type. It is possible that the class is looking for a resource of type RCBITMAP , and not RCDATA . Try to create a TPngImage and load through it. Plus, try FindClassHInstance , otherwise HInstance can be given by the wrong module.

    • yes, it really recompiled rc with INFO BITMAP INFO.bmp DELETE BITMAP DELETE.bmp and when loading it made FInfoButton.Glyph.LoadFromResourceName(FindClassHInstance(TChartEx), 'INFO'); and it worked - gregor