Included in this download are the two programs required for password protection and a sample screen saver. This document is intended to describe the password protectsion programs. This document does not describe how to write a screen saver program in Visual Basic (although all you have to do is use this one as a template). The password protection programs are... GETPSWD.EXE - Displays the dialog box that is used to validate the password to get past the screen saver. CHGPSWD.EXE - Displays the dialog box that is used to change the password. The sample screen saver program includes... ABOUTBOX.FRM - About dialog box called from CONFIGUR.FRM CONFIGUR.FRM - Dialog box to configure the screen saver. DSPBMP.SCR - Compiled version of the Visual Basic screen saver. MAIN.FRM - Screen displayed when the screen saver program is executed. MODULE1.BAS - Contains the declarations, Main subroutine, and ALL_DONE subroutine SCRNSVR.MAK - Visual Basic project file. The Visual Basic sample program is provided to help you understand where the password protection programs are used and how to use them. These programs are really quite simple to use and require little explanation. CHGPSWD.EXE The CHGPSWD.EXE program is the easiest to use. It requires NO interation with the calling program. Normally, changing the password is done in the configuration section of your screen saver. In the sample program provided, there is a "Set Password" button (Command3D5) that the user can press. When this button is pressed, the SHELL routine is used to execute the CHGPSWD.EXE program from the C:\WINDOWS\SYSTEM directory. When the CHGPSWD.EXE program is executed, it displays a dialog box. The user will need to enter the old password, a new password, and a verification password. Once the OK button is pressed, the CONTROL.INI file will be updated with the new password. If an incorrect password is entered for the old password, the CHGPSWD.EXE program will display an appropriate dialog box for you. GETPSWD.EXE Unfortunately, the GETPSWD.EXE program is not as easy to use as the CHGPSWD.EXE program because it requires some form of communication with the screen saver program. The example of how this program is used is found in the "All_Done" routine found in the MODULE1.BAS file. The "All_Done" routine is called whenever a key is pressed or the mouse is moved after the screen saver is running (in screen saver mode). The first thing that the All_Done routine does is check to see if password protection is turned on for this screen saver. (Although most screen savers share the same password, it is up to every screen saver to determine if password protection is turned on for it.) If password protection is not turned on, the program simply ends. Next, the PasswordDslyd flag is checked. The PasswordDslyd flag is used because one movement of the mouse may cause the MouseMove routine to be executed several times. Without this flag, the GETPSWD.EXE program will be executed serveral times. Since password protection is requested, the next line executes the GETPSWD.EXE using the SHELL command. The GETPSWD.EXE program will display a dialog box requesting the password to be entered. If the correct password is entered, GETPSWD will make the cursor visible again (this is how it communicates with the screen saver program). If an incorrect password is entered, a message will be displayed and the program will end. Since the SHELL command does not wait for the executed program to finish, a WHILE loop has been inserted after the SHELL command to suspend further execution until the GETPSWD.EXE program has ended. Once the GETPSWD.EXE program is finished, the cursor is checked to see if it is displayed. If it is, then a valid password was enterd and the program ends. If the cursor is not displayed, an invalid password was entered. As a result, any flags used by the screen saver may need to be reset, reverse the call of "ShowCursor" used to check the state of the cursor, and reset the PasswordDslyd flag.