home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / compak7 / dacpack7.exe / UserList.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-06-22  |  21.4 KB  |  718 lines

  1. VERSION 5.00
  2. Object = "{7813D728-D980-11D1-A28F-00C04FA30E7F}#1.0#0"; "UserList.dll"
  3. Begin VB.Form Form1 
  4.    Caption         =   "DameWare UserList Control Sample"
  5.    ClientHeight    =   6915
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   8295
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   6915
  11.    ScaleWidth      =   8295
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.TextBox Text16 
  14.       Height          =   285
  15.       Left            =   5640
  16.       TabIndex        =   49
  17.       Text            =   "Text16"
  18.       Top             =   5280
  19.       Width           =   1575
  20.    End
  21.    Begin VB.CommandButton Command11 
  22.       Caption         =   "Rename User ID"
  23.       Height          =   375
  24.       Left            =   3960
  25.       TabIndex        =   48
  26.       Top             =   5280
  27.       Width           =   1455
  28.    End
  29.    Begin VB.TextBox Text15 
  30.       Height          =   285
  31.       Left            =   1920
  32.       TabIndex        =   15
  33.       Text            =   "Text15"
  34.       Top             =   4920
  35.       Width           =   1815
  36.    End
  37.    Begin VB.TextBox Text14 
  38.       Height          =   285
  39.       Left            =   1920
  40.       TabIndex        =   3
  41.       Text            =   "Text14"
  42.       Top             =   840
  43.       Width           =   1815
  44.    End
  45.    Begin VB.TextBox Text13 
  46.       Height          =   285
  47.       Left            =   1920
  48.       TabIndex        =   2
  49.       Text            =   "Text13"
  50.       Top             =   480
  51.       Width           =   1815
  52.    End
  53.    Begin VB.CommandButton Command10 
  54.       Caption         =   "Get Domain Controller"
  55.       Height          =   495
  56.       Left            =   3960
  57.       TabIndex        =   18
  58.       Top             =   1320
  59.       Width           =   1455
  60.    End
  61.    Begin VB.TextBox Text12 
  62.       Height          =   285
  63.       Left            =   1920
  64.       TabIndex        =   5
  65.       Text            =   "Text12"
  66.       Top             =   1320
  67.       Width           =   1815
  68.    End
  69.    Begin VB.CheckBox Check6 
  70.       Caption         =   "User Must Change Password at Next Logon"
  71.       Height          =   495
  72.       Left            =   5760
  73.       TabIndex        =   32
  74.       Top             =   3960
  75.       Width           =   2295
  76.    End
  77.    Begin VB.TextBox Text11 
  78.       Height          =   285
  79.       Left            =   1920
  80.       TabIndex        =   11
  81.       Text            =   "Text11"
  82.       Top             =   3480
  83.       Width           =   1815
  84.    End
  85.    Begin VB.CheckBox Check5 
  86.       Caption         =   "User Account Password Dont Expire"
  87.       Height          =   375
  88.       Left            =   5760
  89.       TabIndex        =   31
  90.       Top             =   3480
  91.       Width           =   2175
  92.    End
  93.    Begin VB.CheckBox Check4 
  94.       Caption         =   "User Account Locked Out"
  95.       Height          =   375
  96.       Left            =   5760
  97.       TabIndex        =   30
  98.       Top             =   3000
  99.       Width           =   2175
  100.    End
  101.    Begin VB.CheckBox Check3 
  102.       Caption         =   "User Account Can Not Change  Password "
  103.       Height          =   375
  104.       Left            =   5760
  105.       TabIndex        =   29
  106.       Top             =   2520
  107.       Width           =   2175
  108.    End
  109.    Begin VB.CheckBox Check2 
  110.       Caption         =   "User Account Password Not Required"
  111.       Height          =   375
  112.       Left            =   5760
  113.       TabIndex        =   28
  114.       Top             =   2040
  115.       Width           =   2175
  116.    End
  117.    Begin VB.CheckBox Check1 
  118.       Caption         =   "User Account Disable"
  119.       Height          =   375
  120.       Left            =   5760
  121.       TabIndex        =   27
  122.       Top             =   1560
  123.       Width           =   2175
  124.    End
  125.    Begin VB.CommandButton Command9 
  126.       Caption         =   "Disconnect"
  127.       Height          =   375
  128.       Left            =   3960
  129.       TabIndex        =   17
  130.       Top             =   840
  131.       Width           =   1455
  132.    End
  133.    Begin VB.CommandButton Command8 
  134.       Caption         =   "Connect"
  135.       Height          =   375
  136.       Left            =   3960
  137.       TabIndex        =   4
  138.       Top             =   360
  139.       Width           =   1455
  140.    End
  141.    Begin VB.CommandButton Command7 
  142.       Caption         =   "Set User Info"
  143.       Height          =   375
  144.       Left            =   3960
  145.       TabIndex        =   25
  146.       Top             =   4320
  147.       Width           =   1455
  148.    End
  149.    Begin VB.CommandButton Command6 
  150.       Caption         =   "Get User Info"
  151.       Height          =   375
  152.       Left            =   3960
  153.       TabIndex        =   24
  154.       Top             =   3840
  155.       Width           =   1455
  156.    End
  157.    Begin VB.TextBox Text10 
  158.       Height          =   285
  159.       Left            =   1920
  160.       TabIndex        =   16
  161.       Text            =   "Text10"
  162.       Top             =   5280
  163.       Width           =   1815
  164.    End
  165.    Begin VB.CommandButton Command5 
  166.       Caption         =   "Change Password"
  167.       Height          =   375
  168.       Left            =   3960
  169.       TabIndex        =   26
  170.       Top             =   4800
  171.       Width           =   1455
  172.    End
  173.    Begin VB.CommandButton Command4 
  174.       Caption         =   "Delete User"
  175.       Height          =   375
  176.       Left            =   3960
  177.       TabIndex        =   23
  178.       Top             =   3360
  179.       Width           =   1455
  180.    End
  181.    Begin VB.TextBox Text9 
  182.       Height          =   285
  183.       Left            =   1920
  184.       TabIndex        =   14
  185.       Text            =   "Text9"
  186.       Top             =   4560
  187.       Width           =   1815
  188.    End
  189.    Begin VB.TextBox Text8 
  190.       Height          =   285
  191.       Left            =   1920
  192.       TabIndex        =   13
  193.       Text            =   "Text8"
  194.       Top             =   4200
  195.       Width           =   1815
  196.    End
  197.    Begin VB.TextBox Text7 
  198.       Height          =   285
  199.       Left            =   1920
  200.       TabIndex        =   12
  201.       Text            =   "Text7"
  202.       Top             =   3840
  203.       Width           =   1815
  204.    End
  205.    Begin VB.TextBox Text6 
  206.       Height          =   285
  207.       Left            =   1920
  208.       TabIndex        =   10
  209.       Text            =   "Text6"
  210.       Top             =   3120
  211.       Width           =   1815
  212.    End
  213.    Begin VB.TextBox Text5 
  214.       Height          =   285
  215.       Left            =   1920
  216.       TabIndex        =   9
  217.       Text            =   "Text5"
  218.       Top             =   2760
  219.       Width           =   1815
  220.    End
  221.    Begin VB.TextBox Text4 
  222.       Height          =   285
  223.       Left            =   1920
  224.       TabIndex        =   8
  225.       Text            =   "Text4"
  226.       Top             =   2400
  227.       Width           =   1815
  228.    End
  229.    Begin VB.TextBox Text3 
  230.       Height          =   285
  231.       Left            =   1920
  232.       TabIndex        =   7
  233.       Text            =   "Text3"
  234.       Top             =   2040
  235.       Width           =   1815
  236.    End
  237.    Begin VB.CommandButton Command3 
  238.       Caption         =   "Add User"
  239.       Height          =   375
  240.       Left            =   3960
  241.       TabIndex        =   21
  242.       Top             =   2880
  243.       Width           =   1455
  244.    End
  245.    Begin VB.TextBox Text2 
  246.       Height          =   285
  247.       Left            =   1920
  248.       TabIndex        =   6
  249.       Text            =   "Text2"
  250.       Top             =   1680
  251.       Width           =   1815
  252.    End
  253.    Begin VB.CommandButton Command2 
  254.       Caption         =   "Get Users "
  255.       Height          =   375
  256.       Left            =   3960
  257.       TabIndex        =   20
  258.       Top             =   2400
  259.       Width           =   1455
  260.    End
  261.    Begin VB.ListBox List1 
  262.       Height          =   1140
  263.       IntegralHeight  =   0   'False
  264.       Left            =   120
  265.       Sorted          =   -1  'True
  266.       TabIndex        =   33
  267.       Top             =   5760
  268.       Width           =   8055
  269.    End
  270.    Begin VB.CommandButton Command1 
  271.       Caption         =   "Get All Users"
  272.       Default         =   -1  'True
  273.       Height          =   375
  274.       Left            =   3960
  275.       TabIndex        =   19
  276.       Top             =   1920
  277.       Width           =   1455
  278.    End
  279.    Begin VB.TextBox Text1 
  280.       Height          =   285
  281.       Left            =   1920
  282.       TabIndex        =   1
  283.       Text            =   "Text1"
  284.       Top             =   120
  285.       Width           =   1815
  286.    End
  287.    Begin VB.Label Label16 
  288.       Caption         =   "Rename User ID to:"
  289.       Height          =   255
  290.       Left            =   5640
  291.       TabIndex        =   50
  292.       Top             =   5040
  293.       Width           =   1575
  294.    End
  295.    Begin VB.Label Label15 
  296.       Caption         =   "User Logon Script Name"
  297.       Height          =   255
  298.       Left            =   120
  299.       TabIndex        =   47
  300.       Top             =   4920
  301.       Width           =   1815
  302.    End
  303.    Begin VB.Label Label14 
  304.       Caption         =   "Connect Password"
  305.       Height          =   255
  306.       Left            =   120
  307.       TabIndex        =   46
  308.       Top             =   840
  309.       Width           =   1335
  310.    End
  311.    Begin VB.Label Label13 
  312.       Caption         =   "Connect UserID"
  313.       Height          =   255
  314.       Left            =   120
  315.       TabIndex        =   45
  316.       Top             =   480
  317.       Width           =   1215
  318.    End
  319.    Begin VB.Label Label12 
  320.       Caption         =   "Domain"
  321.       Height          =   255
  322.       Left            =   120
  323.       TabIndex        =   44
  324.       Top             =   1320
  325.       Width           =   735
  326.    End
  327.    Begin VB.Shape Shape1 
  328.       BackStyle       =   1  'Opaque
  329.       FillColor       =   &H00FFFFFF&
  330.       FillStyle       =   0  'Solid
  331.       Height          =   495
  332.       Left            =   6000
  333.       Shape           =   3  'Circle
  334.       Top             =   600
  335.       Width           =   495
  336.    End
  337.    Begin VB.Label Label11 
  338.       Caption         =   "User Home Drive"
  339.       Height          =   255
  340.       Left            =   120
  341.       TabIndex        =   43
  342.       Top             =   3480
  343.       Width           =   1695
  344.    End
  345.    Begin VB.Label Label10 
  346.       Caption         =   "New User Password"
  347.       Height          =   255
  348.       Left            =   120
  349.       TabIndex        =   42
  350.       Top             =   5280
  351.       Width           =   1575
  352.    End
  353.    Begin VB.Label Label9 
  354.       Caption         =   "User Logon Script Path"
  355.       Height          =   255
  356.       Left            =   120
  357.       TabIndex        =   41
  358.       Top             =   4560
  359.       Width           =   1815
  360.    End
  361.    Begin VB.Label Label8 
  362.       Caption         =   "User Password"
  363.       Height          =   255
  364.       Left            =   120
  365.       TabIndex        =   40
  366.       Top             =   4200
  367.       Width           =   1095
  368.    End
  369.    Begin VB.Label Label7 
  370.       Caption         =   "User Home Dir"
  371.       Height          =   255
  372.       Left            =   120
  373.       TabIndex        =   39
  374.       Top             =   3840
  375.       Width           =   1095
  376.    End
  377.    Begin VB.Label Label6 
  378.       Caption         =   "User Logon Server"
  379.       Height          =   255
  380.       Left            =   120
  381.       TabIndex        =   38
  382.       Top             =   3120
  383.       Width           =   1335
  384.    End
  385.    Begin VB.Label Label5 
  386.       Caption         =   "User Comment"
  387.       Height          =   255
  388.       Left            =   120
  389.       TabIndex        =   37
  390.       Top             =   2760
  391.       Width           =   1215
  392.    End
  393.    Begin VB.Label Label4 
  394.       Caption         =   "User Full Name"
  395.       Height          =   255
  396.       Left            =   120
  397.       TabIndex        =   36
  398.       Top             =   2400
  399.       Width           =   1215
  400.    End
  401.    Begin VB.Label Label3 
  402.       Caption         =   "UserID"
  403.       Height          =   255
  404.       Left            =   120
  405.       TabIndex        =   35
  406.       Top             =   2040
  407.       Width           =   615
  408.    End
  409.    Begin VB.Label Label2 
  410.       Caption         =   "Get User Beginning With"
  411.       Height          =   255
  412.       Left            =   120
  413.       TabIndex        =   34
  414.       Top             =   1680
  415.       Width           =   1815
  416.    End
  417.    Begin VB.Label Label1 
  418.       Caption         =   "Machine"
  419.       Height          =   255
  420.       Left            =   120
  421.       TabIndex        =   22
  422.       Top             =   120
  423.       Width           =   735
  424.    End
  425.    Begin USERLISTLibCtl.UserListCtl UserListCtl1 
  426.       Height          =   480
  427.       Left            =   7200
  428.       TabIndex        =   0
  429.       TabStop         =   0   'False
  430.       Top             =   600
  431.       Width           =   480
  432.       UserName        =   ""
  433.       UserFullName    =   ""
  434.       UserComment     =   ""
  435.       UserComment     =   ""
  436.       ConnectPassword =   ""
  437.       ConnectUserID   =   ""
  438.       Machine         =   ""
  439.       UserPassword    =   ""
  440.       UserHomeDir     =   ""
  441.       UserLogonServer =   "\\*"
  442.       UserScriptPath  =   ""
  443.       Domain          =   ""
  444.       UserNewPassword =   ""
  445.       UserAccountDisable=   0
  446.       UserAccountPasswordNotRequired=   0
  447.       UserAccountPasswordCanNotChange=   0
  448.       UserAccountLockedOut=   0
  449.       UserAccountPasswordDontExpire=   0
  450.       UserAccountPasswordExpired=   0
  451.       UserHomeDrive   =   ""
  452.       UserScriptName  =   ""
  453.    End
  454. Attribute VB_Name = "Form1"
  455. Attribute VB_GlobalNameSpace = False
  456. Attribute VB_Creatable = False
  457. Attribute VB_PredeclaredId = True
  458. Attribute VB_Exposed = False
  459. Private Sub Command1_Click()
  460. On Error GoTo ErrorHandler
  461. Shape1.FillColor = &H80FFFF    'yellow busy
  462. Shape1.Refresh
  463. List1.Clear
  464. UserListCtl1.Machine = Text1.Text
  465. UserListCtl1.SetFirstUser
  466. i = 0
  467. While UserListCtl1.UserGetNext <> 0
  468.     List1.AddItem UserListCtl1.UserName + Chr(9) + Chr(9) + UserListCtl1.UserFullName + Chr(9) + Chr(9) + UserListCtl1.UserComment, i
  469.     i = i + 1
  470. Shape1.FillColor = &H80FF80 ' green - returned ok
  471. Shape1.Refresh
  472. Exit Sub
  473. ErrorHandler:
  474.     OnErrorHandler
  475.     'Resume Next
  476. Shape1.FillColor = &HFF&       ' red - failed
  477. Shape1.Refresh
  478. End Sub
  479. Private Sub Command10_Click()
  480. On Error GoTo ErrorHandler
  481. Shape1.FillColor = &H80FFFF    'yellow busy
  482. Shape1.Refresh
  483. UserListCtl1.Domain = Text12.Text
  484. Text1.Text = UserListCtl1.GetDCName
  485. Shape1.FillColor = &H80FF80 ' green - returned ok
  486. Shape1.Refresh
  487. Exit Sub
  488. ErrorHandler:
  489.     OnErrorHandler
  490.     'Resume Next
  491. Shape1.FillColor = &HFF&       ' red - failed
  492. Shape1.Refresh
  493. End Sub
  494. Private Sub Command11_Click()
  495. UserListCtl1.Machine = Text1.Text
  496. UserListCtl1.UserName = Text3.Text
  497. UserListCtl1.RenameUserID (Text16.Text)
  498. End Sub
  499. Private Sub Command2_Click()
  500. On Error GoTo ErrorHandler
  501. Shape1.FillColor = &H80FFFF    'yellow busy
  502. Shape1.Refresh
  503. Dim StringToFind As String
  504. 'UserListCtl1.
  505. List1.Clear
  506. UserListCtl1.Machine = Text1.Text
  507. StringToFind = Text2.Text
  508. If UserListCtl1.SetFirstUserBeginningWith(StringToFind) <> 0 Then
  509.     i = 0
  510.     While UserListCtl1.UserGetNext <> 0
  511.         If InStr(1, UserListCtl1.UserName, StringToFind, vbTextCompare) <> 1 Then
  512.            Shape1.FillColor = &H80FF80 ' green - returned ok
  513.            Shape1.Refresh
  514.            Exit Sub
  515.         End If
  516.         List1.AddItem UserListCtl1.UserName + Chr(9) + Chr(9) + UserListCtl1.UserFullName + Chr(9) + Chr(9) + UserListCtl1.UserComment, i
  517.         i = i + 1
  518.     Wend
  519. End If
  520. Shape1.FillColor = &H80FF80 ' green - returned ok
  521. Shape1.Refresh
  522. Exit Sub
  523. ErrorHandler:
  524.     OnErrorHandler
  525.     'Resume Next
  526. Shape1.FillColor = &HFF&       ' red - failed
  527. Shape1.Refresh
  528. End Sub
  529. Private Sub Command3_Click()
  530. 'UserAdd
  531. On Error GoTo ErrorHandler
  532. Shape1.FillColor = &H80FFFF    'yellow busy
  533. Shape1.Refresh
  534. UserListCtl1.Machine = Text1.Text
  535. UserListCtl1.UserName = Text3.Text
  536. UserListCtl1.UserFullName = Text4.Text
  537. UserListCtl1.UserComment = Text5.Text
  538. UserListCtl1.UserLogonServer = Text6.Text
  539. UserListCtl1.UserHomeDir = Text7.Text
  540. UserListCtl1.UserPassword = Text8.Text
  541. UserListCtl1.UserScriptPath = Text9.Text
  542. UserListCtl1.UserScriptName = Text15.Text
  543. UserListCtl1.UserHomeDrive = Text11.Text
  544. UserListCtl1.UserAccountDisable = Check1.Value
  545. UserListCtl1.UserAccountPasswordNotRequired = Check2.Value
  546. UserListCtl1.UserAccountPasswordCanNotChange = Check3.Value
  547. UserListCtl1.UserAccountLockedOut = Check4.Value
  548. UserListCtl1.UserAccountPasswordDontExpire = Check5.Value
  549. UserListCtl1.UserAccountPasswordExpired = Check6.Value
  550. UserListCtl1.UserAdd
  551. Shape1.FillColor = &H80FF80 ' green - returned ok
  552. Shape1.Refresh
  553. Exit Sub
  554. ErrorHandler:
  555.     OnErrorHandler
  556.     'Resume Next
  557. Shape1.FillColor = &HFF&       ' red - failed
  558. Shape1.Refresh
  559. End Sub
  560. Private Sub Command4_Click()
  561. On Error GoTo ErrorHandler
  562. Shape1.FillColor = &H80FFFF    'yellow busy
  563. Shape1.Refresh
  564. Dim Response
  565. Response = MsgBox("Are you sure you want to delete User: " + Text3.Text + " From: " + Text1.Text, vbQuestion + vbYesNo, "Information")
  566. If Response = vbNo Then
  567.     Shape1.FillColor = &H80FF80 ' green - returned ok
  568.     Shape1.Refresh
  569.     Exit Sub
  570. End If
  571. UserListCtl1.Machine = Text1.Text
  572. UserListCtl1.UserName = Text3.Text
  573. UserListCtl1.UserDelete
  574. Shape1.FillColor = &H80FF80 ' green - returned ok
  575. Shape1.Refresh
  576. Exit Sub
  577. ErrorHandler:
  578.     OnErrorHandler
  579.     'Resume Next
  580. Shape1.FillColor = &HFF&       ' red - failed
  581. Shape1.Refresh
  582. End Sub
  583. Private Sub Command5_Click()
  584. On Error GoTo ErrorHandler
  585. Shape1.FillColor = &H80FFFF    'yellow busy
  586. Shape1.Refresh
  587. UserListCtl1.Machine = Text1.Text
  588. UserListCtl1.UserName = Text3.Text
  589. UserListCtl1.UserNewPassword = Text10.Text
  590. UserListCtl1.UserChangePassword
  591. Shape1.FillColor = &H80FF80 ' green - returned ok
  592. Shape1.Refresh
  593. Exit Sub
  594. ErrorHandler:
  595.     OnErrorHandler
  596.     'Resume Next
  597. Shape1.FillColor = &HFF&       ' red - failed
  598. Shape1.Refresh
  599. End Sub
  600. Private Sub Command6_Click()
  601. On Error GoTo ErrorHandler
  602. 'UserGetInfo
  603. Shape1.FillColor = &H80FFFF    'yellow busy
  604. Shape1.Refresh
  605. UserListCtl1.Machine = Text1.Text
  606. UserListCtl1.UserName = Text3.Text
  607. UserListCtl1.UserGetInfo
  608. Text3.Text = UserListCtl1.UserName
  609. Text4.Text = UserListCtl1.UserFullName
  610. Text5.Text = UserListCtl1.UserComment
  611. Text6.Text = UserListCtl1.UserLogonServer
  612. Text7.Text = UserListCtl1.UserHomeDir
  613. Text8.Text = ""
  614. Text9.Text = UserListCtl1.UserScriptPath
  615. Text15.Text = UserListCtl1.UserScriptName
  616. Text11.Text = UserListCtl1.UserHomeDrive
  617. Check1.Value = UserListCtl1.UserAccountDisable
  618. Check2.Value = UserListCtl1.UserAccountPasswordNotRequired
  619. Check3.Value = UserListCtl1.UserAccountPasswordCanNotChange
  620. Check4.Value = UserListCtl1.UserAccountLockedOut
  621. Check5.Value = UserListCtl1.UserAccountPasswordDontExpire
  622. Check6.Value = UserListCtl1.UserAccountPasswordExpired
  623. Shape1.FillColor = &H80FF80 ' green - returned ok
  624. Shape1.Refresh
  625. Exit Sub
  626. ErrorHandler:
  627.     OnErrorHandler
  628.     'Resume Next
  629. Shape1.FillColor = &HFF&       ' red - failed
  630. Shape1.Refresh
  631. End Sub
  632. Private Sub Command7_Click()
  633. On Error GoTo ErrorHandler
  634. 'UserSetInfo
  635. Shape1.FillColor = &H80FFFF    'yellow busy
  636. Shape1.Refresh
  637. UserListCtl1.Machine = Text1.Text
  638. UserListCtl1.UserName = Text3.Text
  639. UserListCtl1.UserFullName = Text4.Text
  640. UserListCtl1.UserComment = Text5.Text
  641. UserListCtl1.UserLogonServer = Text6.Text
  642. UserListCtl1.UserHomeDir = Text7.Text
  643. UserListCtl1.UserScriptPath = Text9.Text
  644. UserListCtl1.UserScriptName = Text15.Text
  645. UserListCtl1.UserHomeDrive = Text11.Text
  646. UserListCtl1.UserAccountDisable = Check1.Value
  647. UserListCtl1.UserAccountPasswordNotRequired = Check2.Value
  648. UserListCtl1.UserAccountPasswordCanNotChange = Check3.Value
  649. UserListCtl1.UserAccountLockedOut = Check4.Value
  650. UserListCtl1.UserAccountPasswordDontExpire = Check5.Value
  651. UserListCtl1.UserAccountPasswordExpired = Check6.Value
  652. UserListCtl1.UserSetInfo
  653. Shape1.FillColor = &H80FF80 ' green - returned ok
  654. Shape1.Refresh
  655. Exit Sub
  656. ErrorHandler:
  657.     OnErrorHandler
  658.     'Resume Next
  659. Shape1.FillColor = &HFF&       ' red - failed
  660. Shape1.Refresh
  661. End Sub
  662. Private Sub Command8_Click()
  663. On Error GoTo ErrorHandler
  664. Shape1.FillColor = &H80FFFF    'yellow busy
  665. Shape1.Refresh
  666. UserListCtl1.Machine = Text1.Text
  667. UserListCtl1.ConnectPassword = Text14.Text
  668. UserListCtl1.ConnectUserID = Text13.Text
  669. UserListCtl1.ConnectUser
  670. Shape1.FillColor = &H80FF80 ' green - returned ok
  671. Shape1.Refresh
  672. Exit Sub
  673. ErrorHandler:
  674.     OnErrorHandler
  675.     'Resume Next
  676. Shape1.FillColor = &HFF&       ' red - failed
  677. Shape1.Refresh
  678. End Sub
  679. Private Sub Command9_Click()
  680. On Error GoTo ErrorHandler
  681. Shape1.FillColor = &H80FFFF    'yellow busy
  682. Shape1.Refresh
  683. UserListCtl1.Machine = Text1.Text
  684. UserListCtl1.DisconnectUser
  685. Shape1.FillColor = &H80FF80 ' green - returned ok
  686. Shape1.Refresh
  687. Exit Sub
  688. ErrorHandler:
  689.     OnErrorHandler
  690.     'Resume Next
  691. Shape1.FillColor = &HFF&       ' red - failed
  692. Shape1.Refresh
  693. End Sub
  694. Sub OnErrorHandler()
  695. 'MsgBox "Last error was " & UserListCtl1.LastError
  696. If Err.Number <> 0 Then
  697.     MsgBox Err.Description, vbCritical, "Error"
  698. End If
  699. End Sub
  700. Private Sub Form_Load()
  701. Text1.Text = UserListCtl1.GetLocalMachineName
  702. Text2.Text = ""
  703. Text3.Text = UserListCtl1.GetCurrentUserID
  704. Text4.Text = ""
  705. Text5.Text = ""
  706. Text6.Text = ""
  707. Text7.Text = ""
  708. Text8.Text = ""
  709. Text9.Text = ""
  710. Text10.Text = ""
  711. Text11.Text = ""
  712. Text12.Text = ""
  713. Text13.Text = UserListCtl1.GetCurrentUserID
  714. Text14.Text = ""
  715. Text15.Text = ""
  716. Text16.Text = ""
  717. End Sub
  718.