| DeletingShares, GetObject("FileService", "lanmanserver") |
|
|
| Dim strHost As String |
| Dim aHost As IADsContainer |
| Dim aLAN As IADsContainer | |
| Dim aShare As IADsFileShare |
| Dim bFirst As Boolean |
|
| Private Sub cmdAdd_Click() |
| On Error Resume Next |
| If txtName = "" Then |
| MsgBox "Unable to create share" |
| Else |
| Set aShare = aLAN.Create("fileshare", txtName) |
| If Err <> 0 Then |
| MsgBox "Unable to create share" |
| Else |
| aShare.Path = Dir1.List(Dir1.ListIndex) |
| aShare.SetInfo |
| GetShares |
| End If |
| End If |
| End Sub |
|
| Private Sub cmdRemove_Click() |
| If lst.ListIndex <> -1 Then |
| aLAN.Delete "fileshare", lst.List(lst.ListIndex) |
| GetShares |
| End If |
| End Sub |
|
| Private Sub Drive1_Change() |
| Dir1.Path = Drive1.Drive |
| End Sub |
|
| Private Sub Form_Load() |
| strHost = wsTCP.LocalHostName |
| GetShares |
| End Sub |
|
| Private Sub GetShares() |
| On Error Resume Next |
| lst.Clear |
| Me.MousePointer = 11 |
| Set aHost = GetObject("WinNT://" & strHost & ",computer") |
| Set aLAN = aHost.GetObject("FileService", "lanmanserver") |
| Me.MousePointer = 0 |
| For Each aShare In aLAN |
| lst.AddItem aShare.Name |
| Next aShare |
| lst.ListIndex = 0 |
| End Sub |
|
| Private Sub lst_Click() |
| Dim strPath As String |
| txtName = lst.List(lst.ListIndex) |
| Me.MousePointer = 11 |
| Set aShare = aLAN.GetObject("fileshare", txtName) |
| strPath = aShare.Get("Path") |
| Drive1.Drive = Left(strPath, InStr(strPath, ":")) |
| Dir1.Path = strPath |
| Me.MousePointer = 0 |
| End Sub |
|