13.2 Creating resources

The Free Pascal compiler itself doesn’t create any resource files; it just compiles them into the executable. To create resource files, you can use some GUI tools as the Borland resource workshop; but it is also possible to use a Windows resource compiler like gnu windres. windres comes with the gnu binutils, but the Free Pascal distribution also contains a version which you can use.

The usage of windres is straightforward; it reads an input file describing the resources to create and outputs a resource file.

A typical invocation of windres would be

windres -i mystrings.rc -o mystrings.res

this will read the mystrings.rc file and output a mystrings.res resource file.

A complete overview of the windres tools is outside the scope of this document, but here are some things you can use it for:

stringtables

that contain lists of strings.

bitmaps

which are read from an external file.

icons

which are also read from an external file.

Version information

which can be viewed with the Windows explorer.

Menus

Can be designed as resources and used in your GUI applications.

Arbitrary data

Can be included as resources and read with the windows API calls.

Some of these will be described below.