This article was previously published under Q182382
This article has been archived. It is offered "as is" and will no longer be updated.
The ScrnSave.lib static library provides the "standard" Windows (in thisarticle, "Windows" refers to Windows 95 and Windows 98 and does not includeany version of Windows NT) Screen Saver password, not Windows itself. The"standard" Windows Screen Saver password is not available to Screen Saversthat are not written to use ScrnSave.lib. Screen Savers that are notwritten to use ScrnSave.lib need to implement independent passwordauthentication, encryption, and storage.
Windows NT ignores the password handling within the Screen Saver and usesthe user's system password.
The ScrnSave.lib library provides password protection for Screen Saversthat use it. Windows Screen Savers that are not written with ScrnSave.libneed to provide independent password handling. To do this, Screen Saversneed to provide a Password Change dialog box.
The Password Change dialog box is displayed when the Screen Saver isstarted with a "/a <HWND>" argument, where <HWND> is an unsigned decimalnumber representing the HWND of the owner window of the password dialogbox. If no HWND is passed in the Password Change dialog box, the foregroundwindow 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_SCREENSAVEand REGSTR_VALUE_USESCRPASSWORD can be found in regstr.h) registry key ifit needs to use the Screen Saver's password protection. If the Screen Saverdoes need to use its password protection, it needs to prevent the user fromswitching to other applications without giving the password. To do this theScreen Saver needs to call:
int prev; SystemParametersInfo(SPI_SCREENSAVERRUNNING,TRUE,&prev,0);
This prevents the user from using ALT+TAB to switch to another applicationor CTRL+ALT+DELETE to kill the Screen Saver.
When the user hits a key or moves the mouse, the Screen Saver confirms thepassword. If the password is validated, the Screen Saver calls thefollowing to re-enable task switching:
int prev; SystemParametersInfo(SPI_SCREENSAVERRUNNING,FALSE,&prev,0);