Introduction
A .scr file is a screen saver. Microsoft’s page on screen savers says
that screen savers are standard Windows executable files with the extension
.exe, renamed to .scr: to be run by the Control Panel a
screen saver must have the .scr extension, and to be run as a standalone
application it must have .exe. So it is a program, an
.EXE, not a DLL, and the structure on the .EXE page
applies.
A file dropped on any page opens in the explorer as a PE file, with its structure, resources and code.
What is particular: the screen saver library
Most screen savers are written as a module with three required functions, linked
with the screen saver library. The library holds main and the start-up
code, and when the screen saver starts it creates a full-screen window of the class
WindowsScreenSaverClass, whose window procedure is
ScreenSaverProc. There are two versions, Scrnsave.lib for
ANSI characters, which runs on any Windows platform, and Scrnsavw.lib
for Unicode.
| Function | What it does |
|---|---|
ScreenSaverProc | The window procedure; handles messages such as WM_CREATE, WM_TIMER and WM_DESTROY and passes the rest to DefScreenSaverProc. Exported. |
ScreenSaverConfigureDialog | The dialog procedure of the configuration dialog box, shown when the user selects Setup. Exported. The dialog template has the identifier 2003. |
RegisterDialogClasses | Registers window classes for the dialog; must be provided but should not be exported. May simply return true. |
A screen saver also supplies an icon with the identifier ID_APP, shown
only when it is run as a standalone application, and a description string, which must
be the first string (ordinal 1) of the string table; the Control Panel ignores it when
the screen saver has a long file name and uses the file name instead. The Control
Panel finds screen savers by searching for files with the .scr
extension.
Not described
Unknown
- Command line: the page consulted does not describe the command-line arguments with which the system starts a screen saver, or what is stored when one is chosen. They are not given here.
Links
Software
Reference
- PE Format – Microsoft’s specification of PE32 and PE32+
- Handling Screen Savers – the screen saver library, the three required functions, the .scr extension