home *** CD-ROM | disk | FTP | other *** search
/ The Mother of All Windows Books / CD-MOM.iso / cd_mom / newsletr / vbz / vbz1-3 / sssetpw.frm < prev    next >
Text File  |  1993-06-24  |  4KB  |  150 lines

  1. VERSION 2.00
  2. Begin Form frmSetPW 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Change Password"
  5.    Height          =   3195
  6.    Left            =   1635
  7.    LinkTopic       =   "Form2"
  8.    ScaleHeight     =   2790
  9.    ScaleWidth      =   4470
  10.    Top             =   1920
  11.    Width           =   4590
  12.    Begin CommandButton Command2 
  13.       Cancel          =   -1  'True
  14.       Caption         =   "Cancel"
  15.       Height          =   495
  16.       Left            =   2760
  17.       TabIndex        =   7
  18.       Top             =   2160
  19.       Width           =   1215
  20.    End
  21.    Begin CommandButton Command1 
  22.       Caption         =   "Ok"
  23.       Default         =   -1  'True
  24.       Height          =   495
  25.       Left            =   480
  26.       TabIndex        =   6
  27.       Top             =   2160
  28.       Width           =   1215
  29.    End
  30.    Begin TextBox txtConfirm 
  31.       Enabled         =   0   'False
  32.       Height          =   375
  33.       Left            =   2280
  34.       MaxLength       =   20
  35.       PasswordChar    =   "*"
  36.       TabIndex        =   5
  37.       Top             =   1440
  38.       Width           =   2055
  39.    End
  40.    Begin TextBox txtNew 
  41.       Enabled         =   0   'False
  42.       Height          =   375
  43.       Left            =   2280
  44.       MaxLength       =   20
  45.       PasswordChar    =   "*"
  46.       TabIndex        =   3
  47.       Top             =   840
  48.       Width           =   2055
  49.    End
  50.    Begin TextBox txtOld 
  51.       Height          =   375
  52.       Left            =   2280
  53.       MaxLength       =   20
  54.       PasswordChar    =   "*"
  55.       TabIndex        =   1
  56.       Top             =   240
  57.       Width           =   2055
  58.    End
  59.    Begin Label Label3 
  60.       Caption         =   "&Retype New Password:"
  61.       Enabled         =   0   'False
  62.       Height          =   255
  63.       Left            =   120
  64.       TabIndex        =   4
  65.       Top             =   1440
  66.       Width           =   2055
  67.    End
  68.    Begin Label Label2 
  69.       Caption         =   "&NewPassword:"
  70.       Enabled         =   0   'False
  71.       Height          =   255
  72.       Left            =   120
  73.       TabIndex        =   2
  74.       Top             =   840
  75.       Width           =   1455
  76.    End
  77.    Begin Label Label1 
  78.       Caption         =   "&Old Password:"
  79.       Height          =   255
  80.       Left            =   120
  81.       TabIndex        =   0
  82.       Top             =   240
  83.       Width           =   1455
  84.    End
  85. End
  86.  
  87. Sub Command2_Click ()
  88.     Unload Me
  89. End Sub
  90.  
  91. Sub Command1_Click ()
  92.     Title$ = "Change Password"
  93.     Text$ = txtOld.Text
  94.     EncryptString Text$
  95.     If Text$ = IniPassword$ Then
  96.         NewPW$ = txtNew.Text
  97.         RePW$ = txtConfirm.Text
  98.         If NewPW$ = RePW$ Then
  99.             EncryptString NewPW$
  100.             SetIniString "control.ini", "ScreenSaver", "Password", NewPW$
  101.             Unload Me
  102.         Else
  103.             Mess$ = "The values for new Password and Retype New"
  104.             Mess$ = Mess$ + Chr(13) + "Password do not match."
  105.             Mess$ = Mess$ + Chr(13) + Chr(13) + "Try again."
  106.             MsgBox Mess$, 16, Title$
  107.             txtNew = ""
  108.             txtConfirm = ""
  109.             txtNew.SetFocus
  110.         End If
  111.     Else
  112.         Mess$ = "The value for Old Password is not correct" + Chr$(13) + Chr$(13)
  113.         Mess$ = Mess$ + "Check your screen saver password and then"
  114.         Mess$ = Mess$ + Chr$(13) + "try again."
  115.         MsgBox Mess$, 16, Title$
  116.         txtOld = ""
  117.         txtNew = ""
  118.         txtConfirm = ""
  119.         txtOld.SetFocus
  120.     End If
  121.  
  122. End Sub
  123.  
  124. Sub Form_Load ()
  125.     IniPassword$ = GetIniString$("control.ini", "ScreenSaver", "Password", "")
  126.     If Len(IniPassword$) = 0 Then
  127.         Label1.Enabled = False
  128.         txtOld.Enabled = False
  129.         Label2.Enabled = True
  130.         Label3.Enabled = True
  131.         txtNew.Enabled = True
  132.         txtConfirm.Enabled = True
  133.     End If
  134. End Sub
  135.  
  136. Sub txtOld_Change ()
  137.     If Len(txtOld.Text) Then
  138.         Label2.Enabled = True
  139.         Label3.Enabled = True
  140.         txtNew.Enabled = True
  141.         txtConfirm.Enabled = True
  142.     Else
  143.         Label2.Enabled = False
  144.         Label3.Enabled = False
  145.         txtNew.Enabled = False
  146.         txtConfirm.Enabled = False
  147.     End If
  148. End Sub
  149.  
  150.