vb 怎么把目录内所有文件夹的路径列在list1上

现在有一个文件夹 "A" 文件夹中含有若干个子文件夹..这若干个子文件夹中又含有子文件夹..类推..
如果按照以上这种情况..怎么使得在"A"中的子文件夹路径一个一个按照顺序的排列在listbox中呢?
比如:A中含B,C B中含D C中含E
那么 list1的文件列表就会显示为
盘符:\..A\B
盘符:\..A\B\D
盘符:\..A\C
盘符:\..A\C\E..类推上面的这些文件夹名均为假设..如果不知道文件夹的名称..怎么弄

Dim iNull As Integer, lpIDList As Long, lResult As Long
Dim sPath As String, udtBI As BrowseInfo
On Error Resume Next
With udtBI
'Set the owner window
.hWndOwner = Me.hWnd
'lstrcat appends the two strings and returns the memory address
.lpszTitle = lstrcat("请选择文件夹", "") '标题
'Return only if the user selected a directory
.ulFlags = BIF_RETURNONLYFSDIRS
End With

'Show the 'Browse for folder' dialog
lpIDList = SHBrowseForFolder(udtBI)
If lpIDList Then
sPath = String$(MAX_PATH, 0)
'Get the path from the IDList
SHGetPathFromIDList lpIDList, sPath
'free the block of memory
CoTaskMemFree lpIDList
iNull = InStr(sPath, vbNullChar)
If iNull Then
sPath = Left$(sPath, iNull - 1)
End If
End If这段能够遍历一级目录,修改下就能够偏离多极了,或网上收VB遍历文件夹!
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-10-29
用递归来扫描
第2个回答  2013-10-29
右键 排列图标 名称

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网