1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| 'PassDlgTest.vbs - (C) 2003-2009 by Bill Stewart (bstewart@iname.com)
CONST MB_ICONINFORMATION = 64
Const DLG_TITLE = "PassDlg.dll Demo (VBScript)"
Dim WshShell
Dim LogonDialog
Dim PasswordDialog
Set WshShell = CreateObject("WScript.Shell")
' Instantiate the global objects. If these calls fail, the component has not
' been installed.
Set LogonDialog = CreateObject("PassDlg.LogonDialog")
Set PasswordDialog = CreateObject("PassDlg.PasswordDialog")
' Display a LogonDialog. Blank user is OK, blank password is OK, no second
' password field, no initial user name, and dialog box title.
LogonDialogDemo True, True, False, "", "Enter Password"
' Display a LogonDialog. Blank user not allowed, blank password not allowed,
' second password field, initial username of "DOMAIN\UserName", and dialog box
' title.
LogonDialogDemo False, False, True, "DOMAIN\UserName", "Password?"
' Display a PasswordDialog. Blank user is OK, no second password field, and
' dialog box title.
PasswordDialogDemo True, False, "Password Test"
' Display a PasswordDialog. Blank password not allowed, second password,
' and dialog box title.
PasswordDialogDemo False, True, "Enter New Password"
' Demo Sub for the LogonDialog object
Sub LogonDialogDemo(ByVal AllowBlankUserName, ByVal AllowBlankPassword, _
ByVal Confirm, ByVal UserName, ByVal Title)
'
LogonDialog.AllowBlankUserName = AllowBlankUserName
LogonDialog.AllowBlankPassword = AllowBlankPassword
LogonDialog.Confirm = Confirm
LogonDialog.UserName = UserName
LogonDialog.ShowDialog Title
'
If LogonDialog.Canceled Then
WshShell.Popup "Dialog canceled", 0, DLG_TITLE, MB_ICONINFORMATION
Else
WshShell.Popup "User Name: " & LogonDialog.UserName & vbNewLine _
& "Password: " & LogonDialog.Password, 0, DLG_TITLE, MB_ICONINFORMATION
End If
End Sub |
Partager