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

  1. VERSION 2.00
  2. Begin Form DirVolForm 
  3.    Caption         =   "Directory Services Test (Volume APIs)"
  4.    ClientHeight    =   4425
  5.    ClientLeft      =   510
  6.    ClientTop       =   1455
  7.    ClientWidth     =   8295
  8.    Height          =   4830
  9.    Left            =   450
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4425
  12.    ScaleWidth      =   8295
  13.    Top             =   1110
  14.    Width           =   8415
  15.    Begin Frame Frame1 
  16.       Caption         =   "Volume Information"
  17.       Height          =   4215
  18.       Left            =   3840
  19.       TabIndex        =   5
  20.       Top             =   120
  21.       Width           =   4335
  22.       Begin Label InUseLabel 
  23.          Height          =   255
  24.          Left            =   2760
  25.          TabIndex        =   31
  26.          Top             =   3735
  27.          Width           =   1335
  28.       End
  29.       Begin Label VolRestrictLabel 
  30.          Height          =   255
  31.          Left            =   2760
  32.          TabIndex        =   30
  33.          Top             =   3420
  34.          Width           =   1335
  35.       End
  36.       Begin Label Label15 
  37.          Alignment       =   1  'Right Justify
  38.          Caption         =   "Your volume usage (blocks):"
  39.          Height          =   255
  40.          Left            =   120
  41.          TabIndex        =   29
  42.          Top             =   3720
  43.          Width           =   2535
  44.       End
  45.       Begin Label Label14 
  46.          Alignment       =   1  'Right Justify
  47.          Caption         =   "Your volume usage restrictions (blocks):"
  48.          Height          =   375
  49.          Left            =   360
  50.          TabIndex        =   28
  51.          Top             =   3240
  52.          Width           =   2295
  53.       End
  54.       Begin Label VolumeNameLabel 
  55.          Height          =   255
  56.          Left            =   2760
  57.          TabIndex        =   27
  58.          Top             =   360
  59.          Width           =   1335
  60.       End
  61.       Begin Label Label13 
  62.          Alignment       =   1  'Right Justify
  63.          Caption         =   "Name:"
  64.          Height          =   255
  65.          Left            =   1800
  66.          TabIndex        =   26
  67.          Top             =   360
  68.          Width           =   855
  69.       End
  70.       Begin Label RemovableLabel 
  71.          Height          =   255
  72.          Left            =   2760
  73.          TabIndex        =   25
  74.          Top             =   3000
  75.          Width           =   1335
  76.       End
  77.       Begin Label HashingLabel 
  78.          Height          =   255
  79.          Left            =   2760
  80.          TabIndex        =   24
  81.          Top             =   2760
  82.          Width           =   1335
  83.       End
  84.       Begin Label BlockSizeLabel 
  85.          Height          =   255
  86.          Left            =   2760
  87.          TabIndex        =   23
  88.          Top             =   2520
  89.          Width           =   1335
  90.       End
  91.       Begin Label MaxDirEntriesLabel 
  92.          Height          =   255
  93.          Left            =   2760
  94.          TabIndex        =   22
  95.          Top             =   2280
  96.          Width           =   1335
  97.       End
  98.       Begin Label AvailDirEntriesLabel 
  99.          Height          =   255
  100.          Left            =   2760
  101.          TabIndex        =   21
  102.          Top             =   2040
  103.          Width           =   1335
  104.       End
  105.       Begin Label TotalDirEntriesLabel 
  106.          Height          =   255
  107.          Left            =   2760
  108.          TabIndex        =   20
  109.          Top             =   1800
  110.          Width           =   1335
  111.       End
  112.       Begin Label DeletedBlocksLabel 
  113.          Height          =   255
  114.          Left            =   2760
  115.          TabIndex        =   19
  116.          Top             =   1515
  117.          Width           =   1335
  118.       End
  119.       Begin Label PurgableBlocksLabel 
  120.          Height          =   255
  121.          Left            =   2760
  122.          TabIndex        =   18
  123.          Top             =   1080
  124.          Width           =   1335
  125.       End
  126.       Begin Label FreeBlocksLabel 
  127.          Height          =   255
  128.          Left            =   2760
  129.          TabIndex        =   17
  130.          Top             =   840
  131.          Width           =   1335
  132.       End
  133.       Begin Label TotalBlocksLabel 
  134.          Height          =   255
  135.          Left            =   2760
  136.          TabIndex        =   16
  137.          Top             =   600
  138.          Width           =   1335
  139.       End
  140.       Begin Label Label12 
  141.          Alignment       =   1  'Right Justify
  142.          Caption         =   "Removable media:"
  143.          Height          =   255
  144.          Left            =   840
  145.          TabIndex        =   15
  146.          Top             =   3000
  147.          Width           =   1815
  148.       End
  149.       Begin Label Label11 
  150.          Alignment       =   1  'Right Justify
  151.          Caption         =   "Hashing enabled:"
  152.          Height          =   255
  153.          Left            =   840
  154.          TabIndex        =   14
  155.          Top             =   2760
  156.          Width           =   1815
  157.       End
  158.       Begin Label Label10 
  159.          Alignment       =   1  'Right Justify
  160.          Caption         =   "Block size (bytes):"
  161.          Height          =   255
  162.          Left            =   600
  163.          TabIndex        =   13
  164.          Top             =   2520
  165.          Width           =   2055
  166.       End
  167.       Begin Label Label9 
  168.          Alignment       =   1  'Right Justify
  169.          Caption         =   "Max directory entries used:"
  170.          Height          =   255
  171.          Left            =   120
  172.          TabIndex        =   12
  173.          Top             =   2280
  174.          Width           =   2535
  175.       End
  176.       Begin Label Label8 
  177.          Alignment       =   1  'Right Justify
  178.          Caption         =   "Available directory entries:"
  179.          Height          =   255
  180.          Left            =   360
  181.          TabIndex        =   11
  182.          Top             =   2040
  183.          Width           =   2295
  184.       End
  185.       Begin Label Label7 
  186.          Alignment       =   1  'Right Justify
  187.          Caption         =   "Total directory entries:"
  188.          Height          =   255
  189.          Left            =   600
  190.          TabIndex        =   10
  191.          Top             =   1800
  192.          Width           =   2055
  193.       End
  194.       Begin Label Label6 
  195.          Alignment       =   1  'Right Justify
  196.          Caption         =   "Deleted, but not yet purgable blocks:"
  197.          Height          =   375
  198.          Left            =   840
  199.          TabIndex        =   9
  200.          Top             =   1320
  201.          Width           =   1815
  202.       End
  203.       Begin Label Label5 
  204.          Alignment       =   1  'Right Justify
  205.          Caption         =   "Purgable blocks:"
  206.          Height          =   255
  207.          Left            =   1200
  208.          TabIndex        =   8
  209.          Top             =   1080
  210.          Width           =   1455
  211.       End
  212.       Begin Label Label4 
  213.          Alignment       =   1  'Right Justify
  214.          Caption         =   "Free blocks:"
  215.          Height          =   255
  216.          Left            =   1440
  217.          TabIndex        =   7
  218.          Top             =   840
  219.          Width           =   1215
  220.       End
  221.       Begin Label Label3 
  222.          Alignment       =   1  'Right Justify
  223.          Caption         =   "Total blocks:"
  224.          Height          =   255
  225.          Left            =   1320
  226.          TabIndex        =   6
  227.          Top             =   600
  228.          Width           =   1335
  229.       End
  230.    End
  231.    Begin ListBox VolumeList 
  232.       Height          =   1005
  233.       Left            =   1200
  234.       TabIndex        =   3
  235.       Top             =   960
  236.       Width           =   2415
  237.    End
  238.    Begin CommandButton OKButton 
  239.       Caption         =   "&OK"
  240.       Height          =   375
  241.       Left            =   1440
  242.       TabIndex        =   2
  243.       Top             =   3840
  244.       Width           =   855
  245.    End
  246.    Begin ComboBox ServerNameBox 
  247.       Height          =   300
  248.       Left            =   1200
  249.       Sorted          =   -1  'True
  250.       TabIndex        =   0
  251.       Text            =   "ServerNameBox"
  252.       Top             =   360
  253.       Width           =   2415
  254.    End
  255.    Begin Label Label2 
  256.       Alignment       =   1  'Right Justify
  257.       Caption         =   "Volumes:"
  258.       Height          =   255
  259.       Left            =   120
  260.       TabIndex        =   4
  261.       Top             =   960
  262.       Width           =   975
  263.    End
  264.    Begin Label Label1 
  265.       Alignment       =   1  'Right Justify
  266.       Caption         =   "File Server:"
  267.       Height          =   255
  268.       Left            =   0
  269.       TabIndex        =   1
  270.       Top             =   360
  271.       Width           =   1095
  272.    End
  273. Sub Form_Unload (Cancel As Integer)
  274.     SetPreferredConnectionID (originalPrefConnID%)
  275. End Sub
  276. Sub OKButton_Click ()
  277.     Unload DirVolForm
  278. End Sub
  279. Sub ServerNameBox_Click ()
  280.     VolumeList.Clear
  281.     prefServer$ = ServerNameBox.Text
  282.     ccode% = GetConnectionID(prefServer$, connID%)
  283.     If (ccode% = SUCCESSFUL) Then
  284.         SetPreferredConnectionID (connID%)  'tell which file server to send
  285.                                             'requests to
  286.         For volume% = 0 To 31
  287.             volumeName$ = String$(16, 0)
  288.             ccode% = GetVolumeName(volume%, volumeName$)
  289.             If ((ccode% = SUCCESSFUL) And (Asc(volumeName$) <> 0)) Then
  290.                 VolumeList.AddItem Str$(volume%) + "   " + volumeName$
  291.             End If
  292.         Next volume%
  293.         UpdateVolumeStats
  294.     Else
  295.         MsgBox "Unable to get connection ID of server " + prefServer$, MB_OK, "Error"
  296.     End If
  297. End Sub
  298. Sub ServerNameBox_KeyPress (KeyAscii As Integer)
  299.     If (KeyAscii = 13) Then
  300.         ServerNameBox_Click
  301.     End If
  302. End Sub
  303. Sub Form_Load ()
  304.     For connID% = 1 To 8
  305.         fileServerName$ = String$(48, 0)
  306.         If (IsConnectionIDInUse(connID%) = 1) Then
  307.             GetFileServerName connID%, fileServerName$
  308.             ServerNameBox.AddItem fileServerName$
  309.         End If
  310.     Next connID%
  311.     'get name of default file server for combo box
  312.     fileServerName$ = GetDefaultFileServerName()
  313.     ServerNameBox.Text = fileServerName$
  314.     ServerNameBox_Click
  315. End Sub
  316. Sub UpdateVolumeStats ()
  317.     Dim volumeUsage As NWVOL_USAGE
  318.     Dim loginTime As DATE_AND_TIME
  319.     If (VolumeList.ListIndex = -1) Then
  320.         volume% = 0
  321.     Else
  322.         volume% = Val(VolumeList.ListIndex)
  323.     End If
  324.     connID% = GetDefaultConnectionID()
  325.     ccode% = GetVolUsage(connID%, volume%, volumeUsage)
  326.     TotalBlocksLabel.Caption = Str$(volumeUsage.totalBlocks)
  327.     FreeBlocksLabel.Caption = Str$(volumeUsage.freeBlocks)
  328.     PurgableBlocksLabel.Caption = Str$(volumeUsage.purgableBlocks)
  329.     DeletedBlocksLabel.Caption = Str$(volumeUsage.notYetPurgableBlocks)
  330.     TotalDirEntriesLabel.Caption = Str$(volumeUsage.totalDirEntries)
  331.     AvailDirEntriesLabel.Caption = Str$(volumeUsage.availDirEntries)
  332.     MaxDirEntriesLabel.Caption = Str$(volumeUsage.maxDirEntriesUsed)
  333.     BlockSizeLabel.Caption = Str$(volumeUsage.blockSize)
  334.     If (volumeUsage.isHashing <> Chr$(0)) Then
  335.         HashingLabel.Caption = "Yes"
  336.     Else
  337.         HashingLabel.Caption = "No"
  338.     End If
  339.     If (volumeUsage.isRemovable <> Chr$(0)) Then
  340.         RemovableLabel.Caption = "Yes"
  341.     Else
  342.         RemovableLabel.Caption = "No"
  343.     End If
  344.     VolumeNameLabel.Caption = volumeUsage.volName
  345.     'Get user's volume disk space restrictions
  346.     connNum& = GetConnectionNumber()
  347.     myName$ = String$(48, 0)
  348.     ccode% = GetConnectionInformation(connNum&, myName$, myType%, objID&, loginTime)
  349.     ccode% = GetObjectDiskRestrictions(connID%, volume%, objID&, volRestrict&, inUse&)
  350.     If (volRestrict& = &H40000000) Then
  351.         VolRestrictLabel.Caption = "None"
  352.     Else
  353.         VolRestrictLabel.Caption = Str$(volRestrict&)
  354.     End If
  355.     InUseLabel.Caption = Str$(inUse&)
  356. End Sub
  357. Sub VolumeList_Click ()
  358.     UpdateVolumeStats
  359. End Sub
  360.