Skip Links

Network World

  • Social Web 
  • Email 
  • Close

Working with NSIS' screen-saver installer

Gearhead By Mark Gibbs , Network World , 03/18/2008
Gibbs

In my discussion last week about developing a screen-saver installer I left off at the point where I used the freeware Mihov NSIS Helper to create a simple prototype installer script. This script is designed to be turned into a Windows installer application by Nullsoft's outstanding free open source Nullsoft Scriptable Install System, or NSIS.

But a Windows screen saver is essentially system software so more work was needed. For a start, the screen-saver installer has to put the .scr file in the Windows system subdirectory (by default named system32), which is usually under the Windows subdirectory (by default c:\Windows). Of course, this isn't a certainty so you really need to use what the system tells you is the actual directory, so in the NSIS script you have to specify the installation directory accordingly: InstallDir "$SYSDIR".

NSIS also has a number of other predefined constants such as $SYSDIR, $PROGRAMFILES, $DESKTOP, $STARTMENU, and $QUICKLAUNCH; these simplify scripting considerably.

Now, to install a screen saver it is not enough to copy the .scr file to the system directory. Actually it is enough if the user is willing to run the Windows control panel display applet and on the screen-saver tab select the newly installed screen saver. But I wanted to be a little more polished than that, so it was time to do that most dangerous of system changes: Modify the registry.

I write “most dangerous” with tongue firmly in cheek. Given the number of ways you can easily damage or destroy a Windows system, modifying the registry isn't really that perilous, but Microsoft has always been a little obsessive on the topic.

The registry keys for screen savers for the current user can be found in the HKEY_CURRENT_USER (otherwise aliased as HCKU) hive, Microsoft's rather odd name for the major logical sections of the registry.

The first key we need to change is Control Panel\Desktop\Scrnsave.exe, and we need to set it to the file name of the screen saver we just copied into the system directory. If you are in the habit of browsing the registry you'll notice that the entire path is often included in this key, but Microsoft notes that if you are, in fact, using the system directory the path is assumed.

Next you need to set the key Control Panel\Desktop\ScreenSaveActive to "1", which, as you might guess, ensures that the screen saver is active.

Partner Content
CA logo

CA Network & Voice Resource Center

Comprehensive Network & Voice Management Visit CA Network & Voice Management Resource Center and get insights into industry best practices, information that helps you to address your challenges.

CA Network & Voice Management Resource Center

whitepaper

Managing Voice Over IP for Successful Convergence

Voice over IP (VoIP) has much to offer in cost savings but some customers have concerns about VoIP call quality compared to the quality of traditional voice services. This white paper will help you learn how to take the right steps so that voice quality is assured.

Managing VoIP for Successful Convergence

whitepaper

The Changing Face of Network Management

Managing your network is serious business. This paper discusses the benefits of integrating configuration change-awareness into your network fault management solution

Download Whitepaper

Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a NetworkWorld account? Log in here. Register now for a free account.

Videos

rssRss Feed
Get instant email notification when white papers, webcasts, executive guides are added to our library. Stay informed and up-to-date with the latest on IT Technologies with Network World's Resource Alerts.