# About application resources in EPOC

## Contents

- Overview
- Customise the user interface
- User resources
- System resources
- Java and resource files
- File types reference

## Overview

In EPOC, much of the information that defines the appearance, behaviour and functionality of an application is stored in a resource file — external to the main body of the program. This is unlike some other programming environments, in which a single executable contains all the code and information used by the application.

The two types of resource file used in EPOC are application information files and resource files. The difference between these file types is that application information files define application behaviour within the system context, while ordinary resource files define behaviour within an application.

Resource files are accessible by developers using any of the EPOC programming environments, however they are much more useful for C++ and OPL development than for Java. The reasons for this, and the advantages gained by separating an application’s resources from its executable code, are discussed in the following sections.

## Customise the user interface

The EIKON programming framework requires that some aspects of an application’s layout and behaviour, including menu, toolbar and other control structures, are defined in a resource file.

This can have powerful implications for application development. Small changes to the resource file can change an application significantly. For example, the in-built `Help` and `Data` applications are the same — except for some small changes to the menu and toolbar resources.

##### Localisation

Developers can localise an application by simply changing the resource file text associated with each menu item, task bar or other control. Since changes to the text do not change the symbol information in the generated header file, it is not necessary to recompile the application to use the new file. Consequently, a resource file may be generated for each language supported, and the actual resource used is determined by the end-user at installation time.

## User resources

Resource files are not restricted to declaring information used by the EIKON framework. A resource file might also, for example, define resources for dialog text, error messages, and program initialisation.

Again, the advantages of declaring user information in a resource file are that information is loaded only when needed, that resource files can be compressed, and that they can be localised without recompiling the main program.

## System resources

The application information file is a special type of resource file, which defines application properties within the system context. These properties include:

- the appearance of the application icon within the system shell
- whether the application can be embedded
- whether the application is visible in the system shell
- whether new documents for the application can be created from the system shell

In addition, some applications support MIME types, and this property is also defined in the `.aif` file.

The structure of the application information resource file is similar to that of the ordinary resource file. However, since the information to be contained is pre-defined, formatting of `aif` resource files is very simple.

## Java and resource files

Java applications run on a Java Virtual Machine (JVM) and hence do not use the EIKON framework directly. The main implication of this is that while Java applications can read the information in EPOC style resource files, they cannot use the EIKON framework to automatically build the user interface. This is a key advantage of using resource files in C++ and OPL.

Another advantage of using resource files is that it becomes simple to localise applications. However Java has native methods for localising applications, making EPOC resource files unnecessary.

Like C++ and OPL programs, Java applications must have an `.aif` file to have a customised icon and caption, and the ability to be launched from the extras bar. The method used to link the `.aif` file to the Java application, via a `.app` file, is documented in the Java SDK.

## File types reference

The resource compilation process uses a number of file types:

`.rss` | resource source file, for input to `rcomp` or `aiftool.`
`.h` | header file, for inclusion in C++ file
`.rh` | resource header, for inclusion in resource file
`.hrh` | common C++ or resource header, for inclusion in either type of source file
`.rsg` | generated resource header file, output from `rcomp`
`.rsc` | generated resource file, output from `rcomp`
`.aif` | application information file, as defined by the application architecture, output by `aiftool`