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

  1. VERSION 2.00
  2. Begin Form DirDriveForm 
  3.    Caption         =   "Directory Services Test (Drive APIs)"
  4.    ClientHeight    =   3000
  5.    ClientLeft      =   870
  6.    ClientTop       =   1530
  7.    ClientWidth     =   6360
  8.    Height          =   3405
  9.    Left            =   810
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   3000
  12.    ScaleWidth      =   6360
  13.    Top             =   1185
  14.    Width           =   6480
  15.    Begin ListBox DriveList 
  16.       Height          =   1980
  17.       Left            =   120
  18.       TabIndex        =   1
  19.       Top             =   360
  20.       Width           =   6135
  21.    End
  22.    Begin CommandButton OKButton 
  23.       Caption         =   "&OK"
  24.       Height          =   372
  25.       Left            =   3000
  26.       TabIndex        =   0
  27.       Top             =   2520
  28.       Width           =   732
  29.    End
  30.    Begin Label Label2 
  31.       Caption         =   "* Search drives"
  32.       Height          =   252
  33.       Left            =   120
  34.       TabIndex        =   3
  35.       Top             =   2400
  36.       Width           =   1332
  37.    End
  38.    Begin Label Label1 
  39.       Caption         =   "Network drive mappings"
  40.       Height          =   252
  41.       Left            =   120
  42.       TabIndex        =   2
  43.       Top             =   120
  44.       Width           =   2172
  45.    End
  46. Sub OKButton_Click ()
  47.     Unload DirDriveForm
  48. End Sub
  49. Sub Form_Load ()
  50.     'DriveList.Clear
  51.     For drive% = 0 To 25
  52.         ccode% = GetDriveInformation(drive%, connID%, dirHandle%)
  53.         If (dirHandle% <> 0) Then
  54.             dirPath$ = String$(255, 0)
  55.             ccode% = GetDirectoryPath(dirHandle%, dirPath$)
  56.             dirPath$ = Left$(dirPath$, InStr(dirPath$, Chr$(0)) - 1)
  57.             If (ccode% = SUCCESSFUL) Then
  58.                 fileServerName$ = String$(48, 0)
  59.                 GetFileServerName connID%, fileServerName$
  60.                 fileServerName$ = Left$(fileServerName$, InStr(fileServerName$, Chr$(0)) - 1)
  61.         
  62.                 If (IsSearchDrive(drive% + 65) = 1) Then
  63.                     DriveList.AddItem "* " + Chr$(drive% + 65) + ":   " + fileServerName$ + "/" + dirPath$
  64.                 Else
  65.                     DriveList.AddItem "  " + Chr$(drive% + 65) + ":   " + fileServerName$ + "/" + dirPath$
  66.                 End If
  67.             Else
  68.                 DriveList.AddItem "Can't get path for this drive"
  69.             End If
  70.         ElseIf (ccode% <> SUCCESSFUL) Then
  71.               DriveList.AddItem "  " + Chr$(drive% + 65) + ":   " + "Mapped to a local drive"
  72.         End If
  73.     Next drive%
  74. End Sub
  75.