home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form PassChange
- Appearance = 0 'Flat
- BorderStyle = 3 'Fixed Dialog
- Caption = "Jim & Don's Screen Saver Password"
- ClientHeight = 1920
- ClientLeft = 2556
- ClientTop = 4056
- ClientWidth = 5040
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 7.8
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 2244
- HelpContextID = 5
- Icon = "Passchng.frx":0000
- Left = 2508
- LinkTopic = "Form3"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1920
- ScaleWidth = 5040
- ShowInTaskbar = 0 'False
- Top = 3780
- Width = 5136
- Begin VB.TextBox Text3
- Height = 300
- Left = 2760
- TabIndex = 8
- Top = 1140
- Width = 2115
- End
- Begin VB.TextBox Text2
- Height = 300
- Left = 2760
- TabIndex = 7
- Top = 720
- Width = 2115
- End
- Begin VB.TextBox Text1
- Height = 300
- Left = 2760
- TabIndex = 6
- Top = 300
- Width = 2115
- End
- Begin VB.CommandButton Command3
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Cancel = -1 'True
- Caption = "Cancel"
- Height = 324
- Left = 2724
- TabIndex = 1
- Top = 1536
- Width = 1056
- End
- Begin VB.CommandButton Command1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "OK"
- Default = -1 'True
- Height = 336
- Left = 1248
- TabIndex = 0
- Top = 1536
- Width = 1032
- End
- Begin VB.Label Label3
- Appearance = 0 'Flat
- Caption = "&Retype New Password:"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 7.8
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 240
- Left = 300
- TabIndex = 2
- Top = 1200
- Width = 2412
- End
- Begin VB.Label Label2
- Appearance = 0 'Flat
- Caption = "&New Password:"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 7.8
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 240
- Left = 300
- TabIndex = 3
- Top = 780
- Width = 1608
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- Caption = "&Old Password:"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 7.8
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 240
- Left = 300
- TabIndex = 4
- Top = 360
- Width = 1512
- End
- Begin VB.Label Label4
- Appearance = 0 'Flat
- AutoSize = -1 'True
- Caption = "Change Password:"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 7.8
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 192
- Left = 168
- TabIndex = 5
- Top = 120
- Width = 1356
- End
- Attribute VB_Name = "PassChange"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- 'For information about this program see the declarations
- 'section of the JDSaver.BAS module.
- 'This form is used to configure a user's password, used only
- 'by this screen saver. It is is called
- 'from Sub Main when the program is started with
- 'the /a command parameter
- Option Explicit
- Private Sub Command1_Click()
- 'A character-return/line feed will allow formatting of message boxes.
- Dim CR_LF$
- CR_LF = Chr$(13) + Chr$(10)
- 'If a previously entered password exists, the user must enter it to
- 'change the password.
- If Password <> "" Then
- If encrypt(CStr(text1.Text)) <> Password Then
- MsgBox "The value for Old Password is not correct." & CR_LF & CR_LF & "Check your screen-saver password, and then try again.", 16, "Change Password"
- text1.Text = ""
- text2.Text = ""
- text3.Text = ""
- text1.SetFocus
- Exit Sub
- End If
- End If
- 'Both entries of the new password must match.
- If UCase(text2.Text) <> UCase(text3.Text) Then
- MsgBox "The value for New Password and Retype New Password do not match." & CR_LF & CR_LF & "Try again", 16, "Change Password"
- text1.Text = ""
- text2.Text = ""
- text3.Text = ""
- If Password <> "" Then
- text1.SetFocus
- Else
- text2.SetFocus
- End If
- Exit Sub
- End If
- 'Everything matched, so encrypt the new password and store it in
- 'the registry.
- Password = encrypt(CStr(text2.Text))
- SaveSetting "Samples", "JD Screen Saver", "Password", Password
- Unload PassChange
- End Sub
- Private Sub Command3_Click()
- 'Ignore everything and exit.
- Unload PassChange
- End Sub
- Private Sub Form_Load()
- 'When the Display Properties sends a "/a command it also passes
- 'a handle to its main window. We can use that to position our
- 'form over the top part of the window.
- tempLong = GetWindowRect(CPWindow, CPRect)
- Move (CPRect.Left * xPixel) + (((CPRect.Right - CPRect.Left) * xPixel) - Width) / 2, (CPRect.Top + 60) * yPixel
- 'Change the style of the text boxes to show asterisks as characters
- 'are entered.
- Dim styleFlags&
- styleFlags = GetWindowLong(text1.hWnd, GWL_STYLE)
- styleFlags = styleFlags Or ES_PASSWORD
- styleFlags = setWindowLong(text1.hWnd, GWL_STYLE, styleFlags)
- styleFlags = SendMessage(text1.hWnd, EM_SETPASSWORDCHAR, 42, 0&)
- styleFlags = GetWindowLong(text2.hWnd, GWL_STYLE)
- styleFlags = styleFlags Or ES_PASSWORD
- styleFlags = setWindowLong(text2.hWnd, GWL_STYLE, styleFlags)
- styleFlags = SendMessage(text2.hWnd, EM_SETPASSWORDCHAR, 42, 0&)
- styleFlags = GetWindowLong(text3.hWnd, GWL_STYLE)
- styleFlags = styleFlags Or ES_PASSWORD
- styleFlags = setWindowLong(text3.hWnd, GWL_STYLE, styleFlags)
- styleFlags = SendMessage(text3.hWnd, EM_SETPASSWORDCHAR, 42, 0&)
- 'Get any previously saved password
- Password = GetSetting("Samples", "JD Screen Saver", "Password")
- 'If there is not a previous password, we will disable the "old
- 'password" text box
- If Password = "" Then
- label1.ForeColor = vb3DShadow
- text1.Enabled = False
- End If
- End Sub
- Private Sub Form_Paint()
- Static Painted%
- If Painted Then
- Exit Sub
- End If
- Painted = True
- 'Set the initial focus
- If text1.Enabled Then
- text1.SetFocus
- Else
- text2.SetFocus
- End If
- End Sub
-