home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / nivb_src / namesp.frm < prev    next >
Text File  |  1993-06-03  |  4KB  |  137 lines

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