Write your screensaver yourself.

Source: Internet
Author: User
Tags exit command line implement
The screensaver is very simple, it's just an application with an extension of ". SCR" that runs in full screen and meets certain rules, and can be developed in any language.
The screensaver is placed under the system's System32 directory and is automatically invoked by the system. When the system performs a screensaver, it will require a different command parameter to implement different functions, such as normal operation, preview, Setup, etc. As long as we implement different functions for different parameters in the program, our program can be called by the system normally. All of the command parameters and their meanings are as follows:
A detailed explanation of command line parameter meaning
/s normal running screen saver (to the time system automatic call), generally required to receive keyboard events to exit, screen mouse events and their display
/A allows you to display a password Input dialog box when the user ends the screensaver (WIN98 needs to be implemented from the Implementation dialog box, WIN2000, and then automatically return to the lock when the login dialog box, this parameter can not be used)
/C Display the Settings dialog box for this screensaver when selecting a configuration for the screensaver
/P Preview the screensaver when the screensaver is selected, generally requiring a return of the keyboard or mouse event to be received

In C # We can achieve 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)); Pass the parameters to the form
}
Public Myscreensaver (String arg)
{
Achieve Full screen display
This. Width = Screen.PrimaryScreen.Bounds.Width;
This. Height = Screen.PrimaryScreen.Bounds.Height;
This. left = 0;
This. top = 0;
Switch (ARG. ToLower ())
{
Case "/S":
/*... Normal operation Implementation code * *
Break
Case "/a":
/*... Password dialog box implementation code * *
Break
Case "/C":
/*... Parameter Settings Implementation code * *
Break
Case "/P":
/*... Preview Implementation Code * *
Break
Default
Application.exit (); Other cases exit
Break
}
/*... Other code * *
}
/*... It code * *
}

After the program is completed, the generated EXE extension is changed to ". SCR" and then copied to the System32. Then you can select it on the desktop--> "Display Properties"--> "screen saver" and do Other related actions (settings, previews, etc.).



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.