home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Password
- Caption = "Form1"
- ClientHeight = 2355
- ClientLeft = 3180
- ClientTop = 2580
- ClientWidth = 4785
- Height = 2760
- Left = 3120
- LinkTopic = "Form1"
- ScaleHeight = 2355
- ScaleWidth = 4785
- Top = 2235
- Width = 4905
- Begin CommandButton Cancel
- Caption = "Cancel"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Times New Roman"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 465
- Left = 2790
- TabIndex = 5
- Top = 1665
- Width = 1185
- End
- Begin CommandButton OK
- Caption = "OK"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Times New Roman"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 465
- Left = 1170
- TabIndex = 4
- Top = 1665
- Width = 1005
- End
- Begin TextBox NewPassword2
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Times New Roman"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 420
- Left = 2655
- PasswordChar = "*"
- TabIndex = 3
- Text = "Text3"
- Top = 1035
- Width = 2040
- End
- Begin TextBox NewPassword
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Times New Roman"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 420
- Left = 2655
- PasswordChar = "*"
- TabIndex = 2
- Text = "Text2"
- Top = 630
- Width = 2040
- End
- Begin TextBox OldPassword
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Times New Roman"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 420
- Left = 2655
- PasswordChar = "*"
- TabIndex = 1
- Text = "Text1"
- Top = 225
- Width = 2040
- End
- Begin Label Label3
- Caption = "New Password Retyped:"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Times New Roman"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 135
- TabIndex = 7
- Top = 1035
- Width = 2670
- End
- Begin Label Label2
- Caption = "New Password:"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Times New Roman"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Left = 180
- TabIndex = 6
- Top = 675
- Width = 2760
- End
- Begin Label OldPasswordLabel
- Caption = "Old Password:"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Times New Roman"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Left = 180
- TabIndex = 0
- Top = 270
- Width = 2715
- End
- Option Explicit
- Sub Cancel_Click ()
- Hide 'make form invisible
- End Sub
- Sub Form_Load ()
- 'clear fields
- OldPassword.Text = ""
- NewPassword.Text = ""
- NewPassword2.Text = ""
- 'see if existing password
- If Passwd = "" Then
- OldPassword.Enabled = False
- OldPasswordLabel.Enabled = False
- End If
- End Sub
- Sub OK_Click ()
- Dim temp As String
- temp = OldPassword.Text
- OldPassword.Text = UnCase(temp)
- temp = NewPassword.Text
- NewPassword.Text = UnCase(temp)
- temp = NewPassword2.Text
- NewPassword2.Text = UnCase(temp)
- '1st verify old password
- If Passwd <> OldPassword.Text Then
- MsgBox "Old password incorrect", 48, "Change Password"
- Exit Sub
- End If
- 'double check new password
- If NewPassword.Text <> NewPassword2.Text Then
- MsgBox "New password failed retype verify", 48, "Change Password"
- Exit Sub
- End If
- If Len(NewPassword.Text) > NUMCHARS Then
- MsgBox "New password too long" + Chr$(10) + "Maximum length " + Str$(NUMCHARS) + " chars", 48, "Change Password"
- Exit Sub
- End If
- Passwd = NewPassword.Text
- Unload Password 'unload form from memory
- End Sub
- Function UnCase (Text As String) As String
- Dim i As Integer, j As Integer, k As Integer, l As Integer
- Dim outstr As String
- 'gets the unshifted ascii code for characters by
- 'converting each to a virtual key code and then
- 'converting back to ascii
- outstr = ""
- k = Len(Text)
- For i = 1 To k
- j = VkKeyScan(Asc(Mid$(Text, i, 1))) Mod 256 ' convert ascii to virtual key code
- l = MapVirtualKey(j, 2) ' convert virtual key code to ascii
- outstr = outstr + Chr$(l)
- Next i
- UnCase = outstr
- End Function
-