Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Userlogin(Password, ExitApplication)
- Dim Confirm
- Dim PasswordLength As Integer
- ' Password System
- If Password = "" Then
- ' Loop until Password is correct.
- Do While Password = ""
- Password = InputBox("Enter your Password:", "Login")
- PasswordLength = Len(Password)
- ' Asks the user if they want to close the application.
- If Password = "" Then
- Confirm = MsgBox("Are you sure you want to close this application?", vbYesNo, "Confirm")
- End If
- If Confirm = vbYes Then
- ExitApplication = True
- Exit Do
- Exit Sub
- End If
- If Confirm = vbNo Then
- Password = ""
- PasswordLength = 8
- Confirm = ""
- End If
- ' Checks if the Password is 8 characters.
- If Not PasswordLength = 8 Then
- MsgBox "The Password must be 8 characters long." & vbNewLine & vbNewLine & "Please Try again.", vbCritical, "Password Incorrect"
- Password = ""
- End If
- Loop
- End If
- End Sub
- Sub MainSub()
- ' Standard Dim's
- Dim Username As String
- Dim Password As String
- Dim ExitApplication As Boolean
- '_______________________________________________________________________________
- ' Set Values
- ExitApplication = False
- Username = CreateObject("WScript.Network").Username
- '_______________________________________________________________________________
- Call Userlogin(Password, ExitApplication)
- If ExitApplication = True Then
- Exit Sub
- End If
- End Sub
- Function Userlogin(Password, ExitApplication) As Boolean
- ' Loop until Password is correct.
- Do While Password = ""
- Call UserLogin(Password, ExitApplication)
- UserLogin Password, ExitApplication
- ?StrPtr(""), StrPtr(vbNullString)
- 456810912 0
- ?StrPtr(""), StrPtr(vbNullString)
- 458095304 0
- 458097512 0
- 167896456 0
- 241904984 0
- 456810912 0
- If Confirm = vbYes Then
- ExitApplication = True
- Exit Do
- Exit Sub
- End If
- If Confirm = vbNo Then
- Password = ""
- PasswordLength = 8
- Confirm = ""
- End If
- If Confirm = vbYes Then
- '...
- Else
- '...
- End If
- Const RequiredLength As Integer = 8
- If Len(Password) <> RequiredLength Then
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement