procedure TForm1.FormCreate(Sender: TObject);
begin
Image1.Picture.LoadFromLazarusResource('switch');
end;
@wp I honestly do not know how to thank you. I am working on that package editor tool Juha wanted and I did some extensive reading and research into the the way how the IDE does it's magic internally. I am starting to understand it but as you know it is a time consuming process and there is a very steep learning curve. So after many tries with little success and crashing my poor IDE again and again I decided to do this as a stand alone application to start with. The reason I asked how to extract the *.lrs image is because I wanted to display it to the user but I was at a dead loss since all the available public domain documentation on the internet and even the wiki said the way to do this is to:
.lrsInclude .lrs file in the initialization section
initialization
// .LRS files are plain-text pascal statements and need unit LResources to be included in the Uses clause
{$I MyResources.lrs}
end.
.resLoad .res file in the implementation section
implementation
// .RES files are binary resources and can be loaded
{$R MyResources.res}
var
img: TImage;
begin
img.Picture.Bitmap.LoadFromResourceName( hInstance, 'IMG1' );
end;
Both which require me to include the resource file in my unit and does not offer any way for me to dynamically do this on the fly ( or so I thought until I had a look at the zip you just sent). I do not mind generating a unit on teh fly but I do not know how to get it to run once generated from within my app. So I was at that point very close to calling it quits.
Thank you for taking the time and this helps me immensely so I am very grateful and thankful to you for showing me the way. Very much appreciate you sharing the knowledge. Thank you!
I have attached a screenshot of the tool I am building it is very much in it's early stages but does seem to work so far when I was testing. The left most Tmemo shows you the user selected package file (*.lpk) and the file path at the top if the checkbox is checked else just the filename. The listbox next t o it shows the available components found in the package. Number found is shown at the top. The next and last column has two Tmemos stacked and the top one shows you the contents of the selected file in the listbox and the Tmemo a the bottom shows you the *.lrs file contents
if found. I have attached a zip if you or anyone else wants to have a look. The code is messy and like I said may not be to your exacting standrads but one has to begin somewhere?