14.2 Creating a Screen Saver

The SCRNSAVE.H header file 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 the idsAppName string. The idsAppName string should contain a screen saver name of the form Screen Saver.Name, where Name is a unique name for your screen saver. For example, a screen saver named Bouncer would include the following line in the STRINGTABLE statement in its resource-definition file:

STRINGTABLE PRELOAD
BEGIN
    idsAppName          "Screen Saver.Bouncer"
    .
    .  /* other strings */
    .
END

If your screen saver stores configuration information, it should use the idsAppName string as the application heading for the configuration block in the CONTROL.INI file. For more information about storing screen saver configuration information, see Section 14.2.2, “Providing a Configuration Routine.”

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

extern HANDLE hMainInstance;
extern HWND   hMainWindow;

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