Besides the six source code files, PERSON.H and PERSON.CPP from Chapter 2, DATABASE.H and DATABASE.CPP from Chapter 4, and VIEW.H, and VIEW.CPP from Chapter 5, you will need several additional files to compile Phone Book. The files will look like those shown in Listings 1 through 3. You already started a PHBOOK.RC resource script file in Chapter 5.
·To prepare these files, do the following:
1.Create a module-definition file, with the .DEF extension.
The module-definition file specifies the Windows programming environment. It sets such values as the stack size, the heap size, and the module-loading parameters that Windows uses. All Windows programs require a module-definition file.
You can use the module-definition file for Phone Book, PHBOOK.DEF, on the distribution disks, or you can copy HELLO.DEF, rename the copy, and modify it slightly. Change references to Hello, and make any other changes you want. The file appears in Listing 1.
2.Complete the resource file, with the .RC extension, that you started earlier in Chapter 5.
Check your PHBOOK.RC file against Listing 2 and add any missing resource templates. Listing 2 shows the complete resource script file for Phone Book. The items in this file were explained in some detail in Chapter 5.
To build Phone Book, check that your PHBOOK.RC file has the following resource templates (see Listing 2):
An icon resource that specifies the file containing an icon for the program
A menu resource that specifies the File, Person, and Help menus
An accelerator table resource that specifies five accelerator-key mappings
Dialog resources for an About dialog box, two data-entry dialogs, and three Help dialogs
3.Create a resource include file with an .H extension.
The resource include file defines resource ID numbers that the program uses to associate resources with their templates in the .RC file.
You can use the resource include file for Phone Book, RESOURCE.H, on the distribution disks, or you can copy RESOURCE.H from Hello and modify it. The file appears in Listing 3.
For more information about module-definition files and resources, see the Windows SDK Guide to Programming, the Windows SDK Reference, Volume 2, and your Microsoft C/C++ documentation.
At this point, your Phone Book files are complete if you have followed all of the directions in this tutorial. You can check them against the same files on the distribution disks.