Sign in Join
Wiki copytemporary

lazres: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11> **Note:** Since Lazarus v1.4.0, Lazarus has switched to .res format instead of .lrs; see [[Lazarus 1.4.0 release notes]].\
22> To create .res resource files you can use either **lazres** or **winres**
33
44**lazres** is a [[Lazarus Resources|lazarus resource]] tool to create and convert `.rc`, `.lrs` and `.res` files.
55
66Lazres can be found as `<root>/lazarus/tools/lazres.lpi` and might need to be compiled. In Ubuntu installations `lazres` is precompiled and available in `/usr/bin`
77
8-`Usage: lazres resourcefilename filename1[=resname1] [filename2[=resname2] ... filenameN=resname[N]]`\
9-`       lazres resourcefilename @filelist`
8+```text
9+Usage: lazres resourcefilename filename1[=resname1] [filename2[=resname2] ... filenameN=resname[N]]
10+ lazres resourcefilename @filelist
11+```
1012
1113To create a resource file MYRES.RES with two .bmp graphics files use:
1214
13-`lazres MYRES.RES MyImage1.bmp=IMG1 MyImage2.bmp=IMG2`
15+```text
16+lazres MYRES.RES MyImage1.bmp=IMG1 MyImage2.bmp=IMG2
17+```
1418
1519A resource file can be of type:
1620
1721| | | | |
1822|--------|---------------------------|-----------|---------|
1923| `.RC` | resource description file | plaintext | |
2024| `.LRS` | lazarus (pascal) resource | plaintext | |
2125| `.RES` | compiled resource | binary | default |
2226
2327## Using resources
2428
2529### .lrs
2630
2731Include .lrs file in the [[Initialization|initialization]] section
2832
2933``` pascal
3034initialization
3135 // .LRS files are plain-text pascal statements and need unit LResources to be included in the Uses clause
3236 {$I MyResources.lrs}
3337end.
3438```
3539
3640### .res
3741
3842Load .res file in the [[Implementation|implementation]] section
3943
4044``` pascal
4145implementation
4246 // .RES files are binary resources and can be loaded
4347 {$R MyResources.res}
4448
4549var
4650 img: TImage;
4751begin
4852 img.Picture.Bitmap.LoadFromResourceName( hInstance, 'IMG1' );
4953end;
5054```
5155
5256## See also
5357
5458- [[fcl-res|FCL resource units]]
5559- [[Lazarus Resources|Description of using FPC and Lazarus resources]]
5660- [[IDE Window: Project Options|IDE Project Options &gt; Resources]]
5761
5862---
5963*From the Free Pascal wiki, page "lazres", as it stood on 2020-08-13 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history