home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nivb / namesp.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-07  |  4.1 KB  |  128 lines

  1. VERSION 2.00
  2. Begin Form NameSpaceForm 
  3.    Caption         =   "Name Space Services Test"
  4.    ClientHeight    =   1650
  5.    ClientLeft      =   1305
  6.    ClientTop       =   1575
  7.    ClientWidth     =   4965
  8.    Height          =   2055
  9.    Left            =   1245
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1650
  12.    ScaleWidth      =   4965
  13.    Top             =   1230
  14.    Width           =   5085
  15.    Begin ComboBox VolumeBox 
  16.       Height          =   300
  17.       Left            =   1320
  18.       TabIndex        =   6
  19.       Top             =   1200
  20.       Width           =   2415
  21.    End
  22.    Begin ComboBox ServerNameBox 
  23.       Height          =   300
  24.       Left            =   1320
  25.       TabIndex        =   4
  26.       Top             =   720
  27.       Width           =   2415
  28.    End
  29.    Begin CommandButton OkButton 
  30.       Caption         =   "&OK"
  31.       Default         =   -1  'True
  32.       Height          =   375
  33.       Left            =   3840
  34.       TabIndex        =   3
  35.       Top             =   240
  36.       Width           =   975
  37.    End
  38.    Begin CommandButton CancelButton 
  39.       Caption         =   "&Cancel"
  40.       Height          =   375
  41.       Left            =   3840
  42.       TabIndex        =   0
  43.       Top             =   720
  44.       Width           =   975
  45.    End
  46.    Begin Label Label3 
  47.       Caption         =   "Select a file server and volume to scan for name space information."
  48.       Height          =   495
  49.       Left            =   360
  50.       TabIndex        =   5
  51.       Top             =   120
  52.       Width           =   3255
  53.    End
  54.    Begin Label Label1 
  55.       Alignment       =   1  'Right Justify
  56.       Caption         =   "Volume:"
  57.       Height          =   255
  58.       Left            =   360
  59.       TabIndex        =   2
  60.       Top             =   1200
  61.       Width           =   855
  62.    End
  63.    Begin Label Label2 
  64.       Alignment       =   1  'Right Justify
  65.       Caption         =   "File Server:"
  66.       Height          =   255
  67.       Left            =   120
  68.       TabIndex        =   1
  69.       Top             =   720
  70.       Width           =   1095
  71.    End
  72. Sub Form_Unload (Cancel As Integer)
  73.     SetPreferredConnectionID (originalPrefConnID%)
  74. End Sub
  75. Sub GetVolumeList ()
  76.     Dim usage As NWVOL_USAGE
  77.     VolumeBox.Clear
  78.     connID% = GetPreferredConnectionID()
  79.     For volNum% = 0 To 31
  80.         ccode% = GetVolUsage(connID%, volNum%, usage)
  81.         If ((ccode% = SUCCESSFUL) And (Len(usage.volName) > 0)) Then
  82.             VolumeBox.AddItem usage.volName
  83.         End If
  84.     Next volNum%
  85.     VolumeBox.Text = VolumeBox.List(0)
  86. End Sub
  87. Sub OKButton_Click ()
  88.     serverName$ = ServerNameBox.Text
  89.     volumeName$ = VolumeBox.Text
  90.     NameSpaceInfoForm.Show
  91. End Sub
  92. Sub ServerNameBox_Click ()
  93.     prefServer$ = ServerNameBox.Text
  94.     ccode% = GetConnectionID(prefServer$, connID%)
  95.     If (ccode% = SUCCESSFUL) Then
  96.         SetPreferredConnectionID (connID%)  'tell which file server to send
  97.                                             '   requests to
  98.         GetVolumeList
  99.     Else
  100.         MsgBox "Unable to get connection ID of server " + prefServer$, MB_OK, "Error"
  101.         connID% = GetDefaultConnectionID()
  102.         prefServer$ = String$(48, 0)
  103.         GetFileServerName connID%, prefServer$
  104.         prefServer$ = Left$(prefServer$, InStr(prefServer$, Chr$(0)) - 1)
  105.         ServerNameBox.Text = prefServer$
  106.     End If
  107. End Sub
  108. Sub CancelButton_Click ()
  109.     Unload NameSpaceForm
  110. End Sub
  111. Sub Form_Load ()
  112.     Dim volName As String * 16
  113.     fileServerName$ = String$(48, 0)
  114.     For connID% = 1 To 8
  115.         If (ISConnectionIDInUse(connID%)) Then
  116.             GetFileServerName connID%, fileServerName$
  117.             ServerNameBox.AddItem fileServerName$
  118.         End If
  119.     Next connID%
  120.     connID% = GetDefaultConnectionID()
  121.     SetPreferredConnectionID (connID%)
  122.     fileServerName$ = String$(48, 0)
  123.     GetFileServerName connID%, fileServerName$
  124.     fileServerName$ = Left$(fileServerName$, InStr(fileServerName$, Chr$(0)) - 1)
  125.     ServerNameBox.Text = fileServerName$
  126.     GetVolumeList
  127. End Sub
  128.