Creating a Screen Saver

The SCRNSAVE.H header file, included on your MDK disc, defines the function prototypes for the screen-saver functions in SCRNSAVE.LIB. You must include this header file in your source module.

You must also define a global character array, szAppName, in your source module. The szAppName array should contain a screen-saver name of form ScreenSaver.Name, where Name is a unique name for your screen saver. For example, the Bouncer screen saver described at the end of this appendix includes the following declaration:

char szAppName[] = "ScreenSaver.Bouncer";

The WinMain function in SCRNSAVE.LIB uses this variable as the class name for the screen-saver window class. If your screen saver stores configuration information, it should use the szAppName variable as the application heading for the configuration block in the CONTROL.INI file. For complete guidelines for storing screen-saver configuration information, see “Providing a Configuration Routine,” later in this appendix.

Summary: External Handle Variables

Your application can declare the following global variables, which are defined in SCRNSAVE.LIB:

extern HANDLE hMainInstance;
extern HWND   hMainWindow;

The hMainInstance variable contains the instance handle for your application. The hMainWindow variable contains the window handle for the screen-saver window.