Is there a way to have a list of windows shared folders?
If I do something like this:
dim f as folderitem = GetFolderItem("\\\\192.168.10.203", 1)
I can’t do nothing as f.count or f.item(1).
Is there a way to have a list of windows shared folders?
If I do something like this:
dim f as folderitem = GetFolderItem("\\\\192.168.10.203", 1)
I can’t do nothing as f.count or f.item(1).
I’m not sure about doing this in Xojo, but here’s an overview of the Windows NET command options. Hope it helps.
This works on my machine:
Function EnumShares(ShareName As String) As String()
Declare Function NetShareEnum Lib "Netapi32" (ServerName As WString, Level As Integer, ByRef Buffer As Ptr, PrefMaxLen As Integer, ByRef EntriesRead As Integer, ByRef TotalEntries As Integer, ByRef ResumeHandle As Integer) As Integer
Dim read, avail, handle, err As Integer
Dim shareinfo As Ptr ' an array of Ptrs to SHARE_INFO_0 structures
Dim ret() As String
err = NetShareEnum(ShareName, 0, shareinfo, -1, read, avail, handle)
If err = 0 Then
For i As Integer = 0 To read - 1
Dim name As MemoryBlock = shareinfo.Ptr(i * 4) ' assumes 4-byte ptr
ret.Append(name.WString(0))
Next
End If
Return ret
End Function
It uses the NetShareEnum function to list the names of all SMB shares on the server. NetShareEnum can get additional info about the shares by changing the “level” and “buffer” parameters.
It works fine also for me.
Thanks a lot, Andrew