Screen saver quirks
Clone this wiki locally
When a screen saver is run by the user or from Control Panel (e.g. by clicking "Preview"), the process is called by its full path and filename (e.g.
ScreenSaver.scr). However, when Windows runs the screen saver due to the idle timeout, the process is called by its short, DOS-style path and filename (e.g.
Screen~1.scr) with a limit of 8 characters plus a 3 character extension.
In many cases, this won't matter. However, in some cases it can cause problems, so it's something anyone writing a screen saver should know about. An example situation where this can cause issues is the use of Application Settings (which MandelZoom uses). In .NET, programs can use Application Settings to automatically store variables that persist between runs of the program. These variables are stored in an XML file as part of the user's local or roaming (network domain) profile. The XML file gets its path & filename (minus extension) based on the executable itself. If the XML file can't be found when the program runs, the variables are set to their original, built-in defaults.
For screen savers, this means that when a user changes settings in Control Panel, and those settings are stored as Application Settings, they get stored based on the full filename (e.g.
ScreenSaver.scr). Then, when Windows runs the screen saver, it tries to load those settings based on the short filename (e.g.
Screen~1.scr), can't find the settings file, and falls back on the defaults. Whatever settings the user picked in Control Panel still show up in Control Panel's previews and settings, but have no effect on the screen saver when it runs for real. Using short filenames is a simple way to avoid this problem.
##Control Panel display name
By default, Control Panel will display a screen saver's name as its filename minus its extension. For example,
MyScreenSaver.scr will be listed as "MyScreenSaver". However, you may not want to have to depend on the filename (e.g. you may need to use a short filename, see above).
In order to do this, you'll have to compile your program with a native win32 resource file (see the Application tab of the project properties in Visual Studio). This resource file, besides containing any icons and version information, will need a string table. Control Panel will look for a string in this table with an id value of 1 and use that string as the screen saver's display name. For .NET programs (like MandelZoom), this resource file is used instead of a normal .NET icon and manifest.