2.7 Using Generic as a Template

Generic provides essentials that make it an appropriate starting point for your applications. It contains all the files an application can have: .DEF, .H, .RC, and .C files, and a makefile. The About dialog box, an application standard, is included, as is the About Generic . . . command on the Help menu.

You can use Generic as a template to build your own applications. To do this, copy and rename the sources of an existing application, such as Generic; then change relevant function names, and insert new code.

The following steps explain how to use Generic as a template and adapt its source files to your application:

1.Choose your application's filename.

2.Copy the following Generic source files, renaming them to match your application's filename: GENERIC.C, GENERIC.H, GENERIC.DEF, GENERIC.RC, and GENERIC.

3.Use a text editor to change each occurrence of Generic in your application's C-language source file to your application's name. This includes changing the following:

Class name: GenericWClass

Class menu: GenericMenu

Window title: Generic Sample Application

Header filename: GENERIC.H

4.Use a text editor to change each occurrence of Generic in your application's module-definition file to your application's name. This includes changing the application name Generic.

5.Use a text editor to change each occurrence of Generic in your application's resource-definition file to your application's name. This includes changing the following:

Header filename: GENERIC.H

Application title: Generic Application

Menu name: GenericMenu

6.Use a text editor to change each occurrence of Generic in your application's makefile to your application's name. This includes changing the following:

C-language source filename: GENERIC.C

Object filename: GENERIC.OBJ

Executable filename: GENERIC.EXE

Module-definition filename: GENERIC.DEF

As you add new resources and header files to your applications, be sure to use your application's filename to ensure that these names are unique.