Using Bouncer as a Screen Saver Template

To prepare Bouncer as a base for your own screen saver, make the following changes:

File Change

BOUNCER.C Replace code specific to displaying and moving the bitmap across the screen. All Bouncer-specific code is marked with comments.
  Change the szAppName string to your screen-saver name.
BOUNCER.H Replace this file with your own header file.
BOUNCER.DEF Change the NAME and DESCRIPTION lines to reflect the name and description of your screen saver. If your screen saver does not support configuration, put a lowercase x in front of the first colon in the DESCRIPTION line.
BOUNCER.DLG Change the SCREENSAVERCONFIGURE dialog-box definition to match your configuration routine.
BOUNCER.RC Change the ID_APP filename to match your icon filename.
  Remove the bitmap and waveform resource statements.
MAIN.C No changes required. This module is required only for the debugging (.EXE) version of your screen saver.
MAKEFILE Change the NAME macro to the name assigned to your screen-saver source files.
  Change the windir macro to the name of the directory in which Windows is installed.

Summary: Using the NMAKE Build Options

The NMAKE file for the Bouncer screen saver allows you to build a debugging .EXE file or a .SCR file for inclusion in the list of screen savers. It builds a debug version automatically; to build the finished .SCR file, use the following NMAKE command:

C:\MWINDEV\MMSAMPLE\BOUNCER> nmake DEBUG=NO

Note:

Be sure to define the DEBUG macro exactly as shown above, with “NO” in all capitals.

When the DEBUG macro is undefined, your screen-saver module is linked with the MAIN.OBJ module rather than with SCRNSAVE.LIB. MAIN.C contains a WinMain function that replaces the WinMain function in SCRNSAVE.LIB. You can run this version of your screen saver under CodeView, simplifying the debugging process.

The WinMain function defined in MAIN.C works similarly to the WinMain defined in SCRNSAVE.LIB. It performs the following actions, depending on the command-line switch you use to start the program:

Switch Action

-s or /s Activates the screen saver.
-c or /c Displays the screen-saver configuration dialog box.
None Displays the screen-saver configuration dialog box and then activates the screen saver. This action differs from the standard screen-saver behavior.

The screen saver runs until you press a key or click a mouse button.