Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi: Loop data in resource file

I need to loop inside a resource file and and load all BMP files with the following statement; bBitmap.Handle := LoadBitmap(hInstance, 'IMAGE_NAME');

How do I loop a resource file; do I have to do a regular IO operation and treat it like a text file? I can read each line and create a list of bitmap names than on a separate loop execute the above statement to load bitmaps. Or is there a built-in method in Delphi libraries to do this operation?

FILE_NAME_1 BITMAP "btnFile1.bmp"
FILE_NAME_2 BITMAP "btnFile2.bmp"
....

like image 255
Alex Avatar asked Nov 28 '25 22:11

Alex


1 Answers

I suggest you have a look at the Resource Explorer demo included with your Delphi installation. You can find it in "c:\Users\Public\Documents\RAD Studio\9.0\Samples\Delphi\VCL\resXplor\resxplor.dpr" (adjust for different path/Delphi version). In the ExeImage.pas file there are classes that allow you to easily assing the resources to TPicture etc.

like image 188
Larsdk Avatar answered Dec 01 '25 12:12

Larsdk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!