Mosaic: Resource file

We will only add some icons to our resource file for now, and change it later.

Create a new empty text file called mosaic.rc in your mosaic folder. Put the following text in the file:

#include "\masm32\include\resource.h"

#define        ICON1_BIG           400
#define        ICON2_SMALL         401

ICON1_BIG       ICON    DISCARDABLE     "resources\\big.ico"
ICON2_SMALL     ICON    DISCARDABLE     "resources\\small.ico"

If you have a resource editor and you know how to use it, you can make the resource file with an editor, but I will show you how to do it by hand, so everyone can create a resource file, even without a resource editor.

The #include statement includes a file called resourece.h from the masm32 package. This file is included in the masm package so you can use some constants in your resource definitions (like dialog styles etc.). The #defines associate a resource name (ICON1_BIG) with an ID (400 decimal). After you've defined a name, you can define the resource:

ICON1_BIG ICON DISCARDABLE "resources\\big.ico"

This line adds an icon to the resource file (note the double backslash in the filename, always do this, a single backslash is an escape character). The resource is read from the file big.ico in the resources folder. For the small icon it works the same.

3.1 - Resource IDs

In order to use the resources, you will have to know their IDs. We will define IDs in the include file Add the two IDs for the icons to your file:

ICON1_BIG     equ   400
ICON2_SMALL   equ   401

Now you can use ICON_BIG and ICON_SMALL in your programs as an ID.