现在有一个文件夹 "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éåæ件夹ï¼
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éåæ件夹ï¼
温馨提示:答案为网友推荐,仅供参考