

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
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");