|
About Screen Savers
The Desktop application in Windows Control Panel lets users select from a list
of screen savers, specify how much time should elapse before the screen saver
is started, configure screen savers, and preview screen savers. Screen savers
are loaded automatically when Windows starts or when a user activates the screen
saver feature by using Control Panel.
Once a screen saver is chosen, Windows monitors keystrokes and mouse
movements, starting the screen saver after a period of inactivity. However, Windows does
not start the screen saver if any of the following conditions exist:
- The active application is not a Windows-based application.
- A computer-based training (CBT) window is present.
- The active application receives the WM_SYSCOMMAND message with wParam set to the SC_SCREENSAVE value, but does not pass the message to the DefWindowProc function.
Screen savers contain specific exported functions, resource definitions, and
variable declarations. The static-link library SCRNSAVE.LIB contains the main function and other startup code required for a screen saver. When a screen
saver starts, the startup code in SCRNSAVE.LIB creates a full-screen window. The
window class for this window is declared as follows.
WNDCLASS cls;
cls.hCursor = NULL;
cls.hIcon = LoadIcon(hInst, MAKEINTATOM(ID_APP));
cls.lpszMenuName = NULL;
cls.lpszClassName = "WindowsScreenSaverClass";
cls.hbrBackground = GetStockObject(BLACK_BRUSH);
cls.hInstance = hInst;
cls.style = CS_VREDRAW | CS_HREDRAW |
CS_SAVEBITS | CS_DBLCLKS;
cls.lpfnWndProc = (WNDPROC) ScreenSaverProc;
cls.cbWndExtra = 0;
cls.cbClsExtra = 0;
To create a screen saver, most developers create a source-code module
containing three required functions and link them with SCRNSAVE.LIB. A screen saver
module is responsible only for configuring itself and for providing visual
effects.
One of the three required functions in a screen saver module is ScreenSaverProc. This function processes specific messages and passes any unprocessed
messages back to SCRNSAVE.LIB. Following are some of the typical messages processed by ScreenSaverProc.
Message
| Meaning
| WM_CREATE
| Retrieve any initialization data from the file REGEDIT.INI. Set a window timer
for the screen saver window. Perform any other required initialization.
| WM_ERASEBKGND
| Erase the screen saver window and prepare for subsequent drawing operations.
| WM_TIMER
| Perform drawing operations.
| WM_DESTROY
| Destroy the timer(s) created when the application processed the WM_CREATE message. Perform any additional required cleanup.
|
ScreenSaverProc passes unprocessed messages to SCRNSAVE.LIB by calling the DefScreenSaverProc function. The following table describes how this function processes various
messages.
The second required function in a screen saver module is ScreenSaverConfigureDialog. This function displays a dialog box that enables the user to configure the
screen saver. (Thus, an application must provide a corresponding dialog box
template.) Windows displays the configuration dialog box when the user chooses the
Setup button in the Screen Saver box in the Desktop application in Control
Panel. The data entered by the user with the configuration dialog box is stored in
the REGEDIT.INI file.
The third required function in a screen saver module is RegisterDialogClasses. This function must be called by all screen saver applications. However,
applications that do not require special windows or custom controls in the
configuration dialog box can simply return TRUE. Applications requiring custom controls
or special windows should use this function to register the corresponding
window classes.
In addition to creating a module that supports the three functions just
described, a screen saver should supply an icon. This icon is visible only when the
screen saver is run as a standalone application. (To be run by Control Panel, a
screen saver must have the .SCR filename extension; to be run as a standalone
application, it must have the .EXE filename extension.) The icon must be
identified in the screen saver's resource file by the constant ID_APP, which is
defined in the header file SCRNSAVE.H.
One final requirement is a screen saver description string. The resource file
for a screen saver must contain a descriptive string that Control Panel
displays as the screen saver name. The description string must be the first string in
the resource file's string table (identified with the ordinal value 1).
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|