How To Password Protecting Screen Savers without ScrnSave.lib

Article translations Article translations
Article ID: 182382 - View products that this article applies to.
This article was previously published under Q182382
Expand all | Collapse all


The ScrnSave.lib static library provides the "standard" Windows (in this article, "Windows" refers to Windows 95 and Windows 98 and does not include any version of Windows NT) Screen Saver password, not Windows itself. The "standard" Windows Screen Saver password is not available to Screen Savers that are not written to use ScrnSave.lib. Screen Savers that are not written to use ScrnSave.lib need to implement independent password authentication, encryption, and storage.

Windows NT ignores the password handling within the Screen Saver and uses the user's system password.


The ScrnSave.lib library provides password protection for Screen Savers that use it. Windows Screen Savers that are not written with ScrnSave.lib need to provide independent password handling. To do this, Screen Savers need to provide a Password Change dialog box.

The Password Change dialog box is displayed when the Screen Saver is started with a "/a <HWND>" argument, where <HWND> is an unsigned decimal number representing the HWND of the owner window of the password dialog box. If no HWND is passed in the Password Change dialog box, the foreground window should own the Password Change dialog box.

When the Screen Saver runs it should check the HKEY_CURRENT_USER/ REGSTR_PATH_SCREENSAVE/REGSTR_VALUE_USESCRPASSWORD (REGSTR_PATH_SCREENSAVE and REGSTR_VALUE_USESCRPASSWORD can be found in regstr.h) registry key if it needs to use the Screen Saver's password protection. If the Screen Saver does need to use its password protection, it needs to prevent the user from switching to other applications without giving the password. To do this the Screen Saver needs to call:
   int prev;

This prevents the user from using ALT+TAB to switch to another application or CTRL+ALT+DELETE to kill the Screen Saver.

When the user hits a key or moves the mouse, the Screen Saver confirms the password. If the password is validated, the Screen Saver calls the following to re-enable task switching:
   int prev;



Article ID: 182382 - Last Review: July 11, 2005 - Revision: 2.3
  • Microsoft Platform Software Development Kit-January 2000 Edition
  • Microsoft Windows NT Server 3.5
  • Microsoft Windows NT Server 3.51
  • Microsoft Windows NT Server 4.0 Standard Edition
  • Microsoft Windows NT Workstation 3.5
  • Microsoft Windows NT Workstation 3.51
  • Microsoft Windows NT Workstation 4.0 Developer Edition
  • Microsoft Windows 95
kbhowto kbscreensaver KB182382

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from