Now that you have a complete application program, it's a good time for a
quick look at the resource editors. Although the application's resource script,
ex03a.rc, is an ASCII file, modifying it with a text editor is not a good idea. That's
the resource editors' job.
The Contents of ex03a.rc
The resource file determines much of the EX03A application's "look and feel." The file ex03a.rc contains (or points to) the Windows resources listed here.
Resource | Description |
Accelerator | Definitions for keys that simulate menu and toolbar selections. |
Dialog | Layout and contents of dialog boxes. EX03A has only the About dialog box. |
Icon | Icons (16-by-16-pixel and 32-by-32-pixel versions), such as the application icon you see in Microsoft Windows Explorer and in the application's About dialog box. EX03A uses the MFC logo for its application icon. |
Menu | The application's top-level menu and associated pop-up menus. |
String table | Strings that are not part of the C++ source code. |
Toolbar | The row of buttons immediately below the menu. |
Version | Program description, version number, language, and so on. |
In addition to the resources listed above, ex03a.rc contains the statements
#include "afxres.h" #include "afxres.rc"
which bring in some MFC library resources common to all applications. These resources include strings, graphical buttons, and elements needed for printing and OLE.
If you're using the shared DLL version of the MFC library, the common resources are stored inside the MFC DLL.
The ex03a.rc file also contains the statement
#include "resource.h"
This statement brings in the application's three
#define constants, which are
IDR_MAINFRAME (identifying the menu, icon, string list, and
accelerator table), IDR_EX03ATYPE (identifying the default document icon, which
we won't use in this program), and
IDD_ABOUTBOX (identifying the About dialog box). This same resource.h file is included indirectly by the
application's source code files. If you use a resource editor to add more constants
(symbols), the definitions ultimately show up in resource.h. Be careful if you edit this
file in text mode because your changes might be removed the next time you use
a resource editor.
Running the Dialog Resource Editor