home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{7813D728-D980-11D1-A28F-00C04FA30E7F}#1.0#0"; "UserList.dll"
- Begin VB.Form Form1
- Caption = "DameWare UserList Control Sample"
- ClientHeight = 6915
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 8295
- LinkTopic = "Form1"
- ScaleHeight = 6915
- ScaleWidth = 8295
- StartUpPosition = 2 'CenterScreen
- Begin VB.TextBox Text16
- Height = 285
- Left = 5640
- TabIndex = 49
- Text = "Text16"
- Top = 5280
- Width = 1575
- End
- Begin VB.CommandButton Command11
- Caption = "Rename User ID"
- Height = 375
- Left = 3960
- TabIndex = 48
- Top = 5280
- Width = 1455
- End
- Begin VB.TextBox Text15
- Height = 285
- Left = 1920
- TabIndex = 15
- Text = "Text15"
- Top = 4920
- Width = 1815
- End
- Begin VB.TextBox Text14
- Height = 285
- Left = 1920
- TabIndex = 3
- Text = "Text14"
- Top = 840
- Width = 1815
- End
- Begin VB.TextBox Text13
- Height = 285
- Left = 1920
- TabIndex = 2
- Text = "Text13"
- Top = 480
- Width = 1815
- End
- Begin VB.CommandButton Command10
- Caption = "Get Domain Controller"
- Height = 495
- Left = 3960
- TabIndex = 18
- Top = 1320
- Width = 1455
- End
- Begin VB.TextBox Text12
- Height = 285
- Left = 1920
- TabIndex = 5
- Text = "Text12"
- Top = 1320
- Width = 1815
- End
- Begin VB.CheckBox Check6
- Caption = "User Must Change Password at Next Logon"
- Height = 495
- Left = 5760
- TabIndex = 32
- Top = 3960
- Width = 2295
- End
- Begin VB.TextBox Text11
- Height = 285
- Left = 1920
- TabIndex = 11
- Text = "Text11"
- Top = 3480
- Width = 1815
- End
- Begin VB.CheckBox Check5
- Caption = "User Account Password Dont Expire"
- Height = 375
- Left = 5760
- TabIndex = 31
- Top = 3480
- Width = 2175
- End
- Begin VB.CheckBox Check4
- Caption = "User Account Locked Out"
- Height = 375
- Left = 5760
- TabIndex = 30
- Top = 3000
- Width = 2175
- End
- Begin VB.CheckBox Check3
- Caption = "User Account Can Not Change Password "
- Height = 375
- Left = 5760
- TabIndex = 29
- Top = 2520
- Width = 2175
- End
- Begin VB.CheckBox Check2
- Caption = "User Account Password Not Required"
- Height = 375
- Left = 5760
- TabIndex = 28
- Top = 2040
- Width = 2175
- End
- Begin VB.CheckBox Check1
- Caption = "User Account Disable"
- Height = 375
- Left = 5760
- TabIndex = 27
- Top = 1560
- Width = 2175
- End
- Begin VB.CommandButton Command9
- Caption = "Disconnect"
- Height = 375
- Left = 3960
- TabIndex = 17
- Top = 840
- Width = 1455
- End
- Begin VB.CommandButton Command8
- Caption = "Connect"
- Height = 375
- Left = 3960
- TabIndex = 4
- Top = 360
- Width = 1455
- End
- Begin VB.CommandButton Command7
- Caption = "Set User Info"
- Height = 375
- Left = 3960
- TabIndex = 25
- Top = 4320
- Width = 1455
- End
- Begin VB.CommandButton Command6
- Caption = "Get User Info"
- Height = 375
- Left = 3960
- TabIndex = 24
- Top = 3840
- Width = 1455
- End
- Begin VB.TextBox Text10
- Height = 285
- Left = 1920
- TabIndex = 16
- Text = "Text10"
- Top = 5280
- Width = 1815
- End
- Begin VB.CommandButton Command5
- Caption = "Change Password"
- Height = 375
- Left = 3960
- TabIndex = 26
- Top = 4800
- Width = 1455
- End
- Begin VB.CommandButton Command4
- Caption = "Delete User"
- Height = 375
- Left = 3960
- TabIndex = 23
- Top = 3360
- Width = 1455
- End
- Begin VB.TextBox Text9
- Height = 285
- Left = 1920
- TabIndex = 14
- Text = "Text9"
- Top = 4560
- Width = 1815
- End
- Begin VB.TextBox Text8
- Height = 285
- Left = 1920
- TabIndex = 13
- Text = "Text8"
- Top = 4200
- Width = 1815
- End
- Begin VB.TextBox Text7
- Height = 285
- Left = 1920
- TabIndex = 12
- Text = "Text7"
- Top = 3840
- Width = 1815
- End
- Begin VB.TextBox Text6
- Height = 285
- Left = 1920
- TabIndex = 10
- Text = "Text6"
- Top = 3120
- Width = 1815
- End
- Begin VB.TextBox Text5
- Height = 285
- Left = 1920
- TabIndex = 9
- Text = "Text5"
- Top = 2760
- Width = 1815
- End
- Begin VB.TextBox Text4
- Height = 285
- Left = 1920
- TabIndex = 8
- Text = "Text4"
- Top = 2400
- Width = 1815
- End
- Begin VB.TextBox Text3
- Height = 285
- Left = 1920
- TabIndex = 7
- Text = "Text3"
- Top = 2040
- Width = 1815
- End
- Begin VB.CommandButton Command3
- Caption = "Add User"
- Height = 375
- Left = 3960
- TabIndex = 21
- Top = 2880
- Width = 1455
- End
- Begin VB.TextBox Text2
- Height = 285
- Left = 1920
- TabIndex = 6
- Text = "Text2"
- Top = 1680
- Width = 1815
- End
- Begin VB.CommandButton Command2
- Caption = "Get Users "
- Height = 375
- Left = 3960
- TabIndex = 20
- Top = 2400
- Width = 1455
- End
- Begin VB.ListBox List1
- Height = 1140
- IntegralHeight = 0 'False
- Left = 120
- Sorted = -1 'True
- TabIndex = 33
- Top = 5760
- Width = 8055
- End
- Begin VB.CommandButton Command1
- Caption = "Get All Users"
- Default = -1 'True
- Height = 375
- Left = 3960
- TabIndex = 19
- Top = 1920
- Width = 1455
- End
- Begin VB.TextBox Text1
- Height = 285
- Left = 1920
- TabIndex = 1
- Text = "Text1"
- Top = 120
- Width = 1815
- End
- Begin VB.Label Label16
- Caption = "Rename User ID to:"
- Height = 255
- Left = 5640
- TabIndex = 50
- Top = 5040
- Width = 1575
- End
- Begin VB.Label Label15
- Caption = "User Logon Script Name"
- Height = 255
- Left = 120
- TabIndex = 47
- Top = 4920
- Width = 1815
- End
- Begin VB.Label Label14
- Caption = "Connect Password"
- Height = 255
- Left = 120
- TabIndex = 46
- Top = 840
- Width = 1335
- End
- Begin VB.Label Label13
- Caption = "Connect UserID"
- Height = 255
- Left = 120
- TabIndex = 45
- Top = 480
- Width = 1215
- End
- Begin VB.Label Label12
- Caption = "Domain"
- Height = 255
- Left = 120
- TabIndex = 44
- Top = 1320
- Width = 735
- End
- Begin VB.Shape Shape1
- BackStyle = 1 'Opaque
- FillColor = &H00FFFFFF&
- FillStyle = 0 'Solid
- Height = 495
- Left = 6000
- Shape = 3 'Circle
- Top = 600
- Width = 495
- End
- Begin VB.Label Label11
- Caption = "User Home Drive"
- Height = 255
- Left = 120
- TabIndex = 43
- Top = 3480
- Width = 1695
- End
- Begin VB.Label Label10
- Caption = "New User Password"
- Height = 255
- Left = 120
- TabIndex = 42
- Top = 5280
- Width = 1575
- End
- Begin VB.Label Label9
- Caption = "User Logon Script Path"
- Height = 255
- Left = 120
- TabIndex = 41
- Top = 4560
- Width = 1815
- End
- Begin VB.Label Label8
- Caption = "User Password"
- Height = 255
- Left = 120
- TabIndex = 40
- Top = 4200
- Width = 1095
- End
- Begin VB.Label Label7
- Caption = "User Home Dir"
- Height = 255
- Left = 120
- TabIndex = 39
- Top = 3840
- Width = 1095
- End
- Begin VB.Label Label6
- Caption = "User Logon Server"
- Height = 255
- Left = 120
- TabIndex = 38
- Top = 3120
- Width = 1335
- End
- Begin VB.Label Label5
- Caption = "User Comment"
- Height = 255
- Left = 120
- TabIndex = 37
- Top = 2760
- Width = 1215
- End
- Begin VB.Label Label4
- Caption = "User Full Name"
- Height = 255
- Left = 120
- TabIndex = 36
- Top = 2400
- Width = 1215
- End
- Begin VB.Label Label3
- Caption = "UserID"
- Height = 255
- Left = 120
- TabIndex = 35
- Top = 2040
- Width = 615
- End
- Begin VB.Label Label2
- Caption = "Get User Beginning With"
- Height = 255
- Left = 120
- TabIndex = 34
- Top = 1680
- Width = 1815
- End
- Begin VB.Label Label1
- Caption = "Machine"
- Height = 255
- Left = 120
- TabIndex = 22
- Top = 120
- Width = 735
- End
- Begin USERLISTLibCtl.UserListCtl UserListCtl1
- Height = 480
- Left = 7200
- TabIndex = 0
- TabStop = 0 'False
- Top = 600
- Width = 480
- UserName = ""
- UserFullName = ""
- UserComment = ""
- UserComment = ""
- ConnectPassword = ""
- ConnectUserID = ""
- Machine = ""
- UserPassword = ""
- UserHomeDir = ""
- UserLogonServer = "\\*"
- UserScriptPath = ""
- Domain = ""
- UserNewPassword = ""
- UserAccountDisable= 0
- UserAccountPasswordNotRequired= 0
- UserAccountPasswordCanNotChange= 0
- UserAccountLockedOut= 0
- UserAccountPasswordDontExpire= 0
- UserAccountPasswordExpired= 0
- UserHomeDrive = ""
- UserScriptName = ""
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- List1.Clear
- UserListCtl1.Machine = Text1.Text
- UserListCtl1.SetFirstUser
- i = 0
- While UserListCtl1.UserGetNext <> 0
- List1.AddItem UserListCtl1.UserName + Chr(9) + Chr(9) + UserListCtl1.UserFullName + Chr(9) + Chr(9) + UserListCtl1.UserComment, i
- i = i + 1
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command10_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- UserListCtl1.Domain = Text12.Text
- Text1.Text = UserListCtl1.GetDCName
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command11_Click()
- UserListCtl1.Machine = Text1.Text
- UserListCtl1.UserName = Text3.Text
- UserListCtl1.RenameUserID (Text16.Text)
- End Sub
- Private Sub Command2_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- Dim StringToFind As String
- 'UserListCtl1.
- List1.Clear
- UserListCtl1.Machine = Text1.Text
- StringToFind = Text2.Text
- If UserListCtl1.SetFirstUserBeginningWith(StringToFind) <> 0 Then
- i = 0
- While UserListCtl1.UserGetNext <> 0
- If InStr(1, UserListCtl1.UserName, StringToFind, vbTextCompare) <> 1 Then
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- End If
- List1.AddItem UserListCtl1.UserName + Chr(9) + Chr(9) + UserListCtl1.UserFullName + Chr(9) + Chr(9) + UserListCtl1.UserComment, i
- i = i + 1
- Wend
- End If
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command3_Click()
- 'UserAdd
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- UserListCtl1.Machine = Text1.Text
- UserListCtl1.UserName = Text3.Text
- UserListCtl1.UserFullName = Text4.Text
- UserListCtl1.UserComment = Text5.Text
- UserListCtl1.UserLogonServer = Text6.Text
- UserListCtl1.UserHomeDir = Text7.Text
- UserListCtl1.UserPassword = Text8.Text
- UserListCtl1.UserScriptPath = Text9.Text
- UserListCtl1.UserScriptName = Text15.Text
- UserListCtl1.UserHomeDrive = Text11.Text
- UserListCtl1.UserAccountDisable = Check1.Value
- UserListCtl1.UserAccountPasswordNotRequired = Check2.Value
- UserListCtl1.UserAccountPasswordCanNotChange = Check3.Value
- UserListCtl1.UserAccountLockedOut = Check4.Value
- UserListCtl1.UserAccountPasswordDontExpire = Check5.Value
- UserListCtl1.UserAccountPasswordExpired = Check6.Value
- UserListCtl1.UserAdd
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command4_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- Dim Response
- Response = MsgBox("Are you sure you want to delete User: " + Text3.Text + " From: " + Text1.Text, vbQuestion + vbYesNo, "Information")
- If Response = vbNo Then
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- End If
- UserListCtl1.Machine = Text1.Text
- UserListCtl1.UserName = Text3.Text
- UserListCtl1.UserDelete
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command5_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- UserListCtl1.Machine = Text1.Text
- UserListCtl1.UserName = Text3.Text
- UserListCtl1.UserNewPassword = Text10.Text
- UserListCtl1.UserChangePassword
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command6_Click()
- On Error GoTo ErrorHandler
- 'UserGetInfo
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- UserListCtl1.Machine = Text1.Text
- UserListCtl1.UserName = Text3.Text
- UserListCtl1.UserGetInfo
- Text3.Text = UserListCtl1.UserName
- Text4.Text = UserListCtl1.UserFullName
- Text5.Text = UserListCtl1.UserComment
- Text6.Text = UserListCtl1.UserLogonServer
- Text7.Text = UserListCtl1.UserHomeDir
- Text8.Text = ""
- Text9.Text = UserListCtl1.UserScriptPath
- Text15.Text = UserListCtl1.UserScriptName
- Text11.Text = UserListCtl1.UserHomeDrive
- Check1.Value = UserListCtl1.UserAccountDisable
- Check2.Value = UserListCtl1.UserAccountPasswordNotRequired
- Check3.Value = UserListCtl1.UserAccountPasswordCanNotChange
- Check4.Value = UserListCtl1.UserAccountLockedOut
- Check5.Value = UserListCtl1.UserAccountPasswordDontExpire
- Check6.Value = UserListCtl1.UserAccountPasswordExpired
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command7_Click()
- On Error GoTo ErrorHandler
- 'UserSetInfo
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- UserListCtl1.Machine = Text1.Text
- UserListCtl1.UserName = Text3.Text
- UserListCtl1.UserFullName = Text4.Text
- UserListCtl1.UserComment = Text5.Text
- UserListCtl1.UserLogonServer = Text6.Text
- UserListCtl1.UserHomeDir = Text7.Text
- UserListCtl1.UserScriptPath = Text9.Text
- UserListCtl1.UserScriptName = Text15.Text
- UserListCtl1.UserHomeDrive = Text11.Text
- UserListCtl1.UserAccountDisable = Check1.Value
- UserListCtl1.UserAccountPasswordNotRequired = Check2.Value
- UserListCtl1.UserAccountPasswordCanNotChange = Check3.Value
- UserListCtl1.UserAccountLockedOut = Check4.Value
- UserListCtl1.UserAccountPasswordDontExpire = Check5.Value
- UserListCtl1.UserAccountPasswordExpired = Check6.Value
- UserListCtl1.UserSetInfo
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command8_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- UserListCtl1.Machine = Text1.Text
- UserListCtl1.ConnectPassword = Text14.Text
- UserListCtl1.ConnectUserID = Text13.Text
- UserListCtl1.ConnectUser
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command9_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- UserListCtl1.Machine = Text1.Text
- UserListCtl1.DisconnectUser
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Sub OnErrorHandler()
- 'MsgBox "Last error was " & UserListCtl1.LastError
- If Err.Number <> 0 Then
- MsgBox Err.Description, vbCritical, "Error"
- End If
- End Sub
- Private Sub Form_Load()
- Text1.Text = UserListCtl1.GetLocalMachineName
- Text2.Text = ""
- Text3.Text = UserListCtl1.GetCurrentUserID
- Text4.Text = ""
- Text5.Text = ""
- Text6.Text = ""
- Text7.Text = ""
- Text8.Text = ""
- Text9.Text = ""
- Text10.Text = ""
- Text11.Text = ""
- Text12.Text = ""
- Text13.Text = UserListCtl1.GetCurrentUserID
- Text14.Text = ""
- Text15.Text = ""
- Text16.Text = ""
- End Sub
-