

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for creating a windows screen saver using c#. It covers the different modes of operation, including configuration mode, preview mode, and full-screen mode. The document also explains how to store and retrieve settings from the windows registry and how to use the iswindowvisible and getclientrect win32 api functions in preview mode. A simple screen saver example is provided for demonstration.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


static void Main() { string[] cmdList = Environment.CommandLine.Split(' ');
// First command-line param is the exe name, second param is the mode
if (cmdList.Length >= 2) { if (cmdList[1].IndexOf("/c") >= 0) { // Configuration mode Application.Run(new OptionsForm()); return; }
parentHwnd = IntPtr.Zero;
if (cmdList[1] == "/p") { // Preview mode previewMode = true;
// Handle to preview dialog box is next command-line param parentHwnd = (IntPtr) uint.Parse(cmdList[2]); } }
Application.Run(new ScreenSaverForm()); }
using Microsoft.Win32;
// Store in Registry RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE\Demo_ScreenSaver"); if (key != null) Registry.LocalMachine.DeleteSubKeyTree("SOFTWARE\Demo_ScreenSaver"); key = Registry.LocalMachine.CreateSubKey("SOFTWARE\Demo_ScreenSaver"); key.SetValue("text", "some text");
// Read from Registry RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE\Demo_ScreenSaver"); if (key != null) string text = (string)key.GetValue("text");