The screen saver is very simple. It is just an extension ".scr", full screen run, and meets a certain rule, we can develop in any language. The screen save program is placed under the System 32 directory of the system and is automatically called automatically. When the system performs a screen saver, it will require a different command parameter to achieve different functions, such as normal operation, preview, settings, etc. As long as we implement different features for different parameters in the program, our programs can be called normally. The following lists all of the command parameters and its significance:
Command line parameters Signification / s Normal Run Packarator (to time system automatically call), generally requiring to exit to receive the keyboard event, shield the mouse event and its display / a allowed to display a password input conversation when the user ends the screen Box (Win98 requires self-implemented dialogs, Win2000, automatically returns the login dialog, this parameter can not be used) / c When the screen saver is selected, the parameter setting dialog box / P is selected in the screen. When configuring, preview the screen saver, generally requested to return to the receiving keyboard or mouse event.
In C # we can implement this:
Using system;
Using system.collections;
Using system.componentmodel;
Using system.drawing;
Using system.windows.forms;
Public Class MyScreensaver: System.Windows.Forms.form
{
Public static void main (string arg)
{
Application.run (New MyScreensaver (Arg)); // Transport the parameters to the FORM
}
Public MyScreensaver (String Arg)
{
// Realize full screen display
THIS.WIDTH = Screen.primaryScreen.bounds.width;
THISHEIGHT = Screen.primaryScreen.Bounds.Height;
THIS.LEFT = 0;
THIS.TOP = 0;
Switch (arg.tolower ())
{
Case "/ s":
/ * ... normal running implementation code * /
Break;
Case "/ a":
/ * ... Password dialog implements code * /
Break;
Case "/ c":
/ * ... Parameter setting implementation code * /
Break;
Case "/ p":
/ * ... Preview implementation code * /
Break;
DEFAULT:
Application.exit (); / / other cases exit
Break;
}
/ * ... Other code * /
}
/ * ... it code * /
}
After the program is successful, change the generated EXE extension ".scr", then copy to System32. Then you can choose at the desktop -> "Display Properties" -> "Screen Saver" and make other related operations (settings, previews, etc.).