小问题(关于共享文件夹)

fishboyok 2002-09-23 05:55:56
哪个api函数可以得到系统的共享文件夹?跟共享文件夹有关系的函数是哪些?
...全文
65 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ityaa 2002-11-22
  • 打赏
  • 举报
回复
在注册表中找应该是比较容易的
fishboyok 2002-11-22
  • 打赏
  • 举报
回复
请继续关注!
fishboyok 2002-10-09
  • 打赏
  • 举报
回复
有没有什么动态链接库,或者控件可以实现这些功能?
coolsky 2002-09-25
  • 打赏
  • 举报
回复
up
oceanmap 2002-09-25
  • 打赏
  • 举报
回复
转载http://www.csdn.net/expert/topic/933/933770.xml?temp=.1957666上acptvb(微软全球技术中心 VB技术支持) ( )的文章
感谢您使用微软产品。

您可以通过ADSI方式的IADsFileShare对象得到目录的共享信息包括共享名,再用函数Dir获得递归获得目录下的所有文件。 如下例:

Dim fserv As Object
Dim share As Object
Dim shareNew As Object
Dim ShareRoot As String

Function FindDirs(path As String)

Dim DirName As String ' SubDirectory Name.
Dim dirNames() As String ' Buffer for directory name entries.

Dim nDir As Integer ' Number of directories in this path.
Dim i As Integer ' For-loop counter.

On Error GoTo sysFileERR
If Right(path, 1) <> "\" Then path = path & "\"
' Search for subdirectories.
nDir = 0
ReDim dirNames(nDir)
DirName = Dir(path, vbDirectory Or vbHidden Or vbArchive Or vbReadOnly _
Or vbSystem) ' Even if hidden, and so on.
Do While Len(DirName) > 0
' Ignore the current and encompassing directories.
If (DirName <> ".") And (DirName <> "..") Then
' Check for directory with bitwise comparison.
If GetAttr(path & DirName) And vbDirectory Then
dirNames(nDir) = DirName
nDir = nDir + 1
ReDim Preserve dirNames(nDir)
' List1.AddItem path & DirName ' Uncomment to list
End If ' directories.
sysFileERRCont:
End If
List1.AddItem path & DirName
DirName = Dir() ' Get next subdirectory.
Loop

' If there are sub-directories..
If nDir > 0 Then
' Recursively walk into them
For i = 0 To nDir - 1
FindDirs = FindDirs + FindDirs(path & dirNames(i) & "\")
Next i
End If

AbortFunction:
Exit Function
sysFileERR:
If Right(DirName, 4) = ".sys" Then
Resume sysFileERRCont ' Known issue with pagefile.sys
Else
MsgBox "Error: " & Err.Number & " - " & Err.Description, , _
"Unexpected Error"
Resume AbortFunction
End If
End Function

Private Sub Command1_Click()

ShareRoot = "WinNT://"

Set fserv = GetObject("WinNT://COMPUTERNAME/LanmanServer")

Debug.Print "**************************"

For Each share In fserv
Debug.Print share.Name
Debug.Print share.Path
Debug.Print share.Class
Debug.Print share.HostComputer
FindStr = "\" + "\" + ComputerNameStr + "\" + share.Name
Debug.Print FindStr
FileSize = FindDirs(FindStr)
Next share

End Sub

请参考下面的例子:
Q234234 How to Manage File Shares Using ADSI
http://support.microsoft.com/support/kb/articles/q234/2/34.asp
Q169398 HOWTO: Manipulate File Shares with ADSI (VB Sample)
http://support.microsoft.com/support/kb/articles/q169/3/98.asp
HOWTO: Search Directories to Find or List Files (Q185476)
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q185476

- 微软全球技术中心 VB技术支持

本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款
(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查
(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
fishboyok 2002-09-25
  • 打赏
  • 举报
回复
高手们,赶快进来啊,分数不够可以再加!我的分数多的是!
凌波微搏 2002-09-23
  • 打赏
  • 举报
回复
我找找

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧