急!!!请教将以下模块多级目录搜索变成两级目录搜索:
Option Explicit Public Function TreeSearch(ByVal sPath As String, ByVal sFileSpec As String, sFiles() As String) As Long Static ltyFiles As Long '文件数目 Dim sDir As String Dim sSubDirs() As String '存放子目录名称 Dim ltyIndex As Long Dim i As Long If Right(sPath, 1) <> "\" Then sPath = sPath & "\" sDir = Dir(sPath & sFileSpec) '获得当前目录下文件名和数目 Do While Len(sDir) ltyFiles = ltyFiles + 1 ReDim Preserve sFiles(1 To ltyFiles) sFiles(ltyFiles) = sPath & sDir sDir = Dir Loop '获得当前目录下的子目录名称 ltyIndex = 0 sDir = Dir(sPath & "*.*", 16) Do While Len(sDir) 'Do While ltyIndex = 100 If Left(sDir, 1) <> "." Then 'skip.and.. '找出子目录名 If GetAttr(sPath & sDir) And vbDirectory Then ltyIndex = ltyIndex + 1 '保存子目录名 ReDim Preserve sSubDirs(1 To ltyIndex) sSubDirs(ltyIndex) = sPath & sDir & "\" End If End If sDir = Dir Loop For ltyIndex = 1 To ltyIndex '查找每一个子目录下文件,这里利用了递归 Call TreeSearch(sSubDirs(ltyIndex), sFileSpec, sFiles()) Next ltyIndex TreeSearch = ltyFiles End Function
声明一下,本人不懂Basic,只是照葫芦画瓢。 Option Explicit Public Function TreeSearch(ByVal sPath As String, ByVal sFileSpec As String, sFiles() As String, level as Long) As Long Static ltyFiles As Long '文件数目 Dim sDir As String Dim sSubDirs() As String '存放子目录名称 Dim ltyIndex As Long Dim i As Long if ( level > 2 ) return; If Right(sPath, 1) <> "\" Then sPath = sPath & "\" sDir = Dir(sPath & sFileSpec) '获得当前目录下文件名和数目 Do While Len(sDir) ltyFiles = ltyFiles + 1 ReDim Preserve sFiles(1 To ltyFiles) sFiles(ltyFiles) = sPath & sDir sDir = Dir Loop '获得当前目录下的子目录名称 ltyIndex = 0 sDir = Dir(sPath & "*。
*", 16) Do While Len(sDir) 'Do While ltyIndex = 100 If Left(sDir, 1) <> "。" Then 'skip。and。。
'找出子目录名 If GetAttr(sPath & sDir) And vbDirectory Then ltyIndex = ltyIndex + 1 '保存子目录名 ReDim Preserve sSubDirs(1 To ltyIndex) sSubDirs(ltyIndex) = sPath & sDir & "\" End If End If sDir = Dir Loop For ltyIndex = 1 To ltyIndex '查找每一个子目录下文件,这里利用了递归 Call TreeSearch(sSubDirs(ltyIndex), sFileSpec, sFiles(), level) Next ltyIndex TreeSearch = ltyFiles End Function 。
答:您好,若您机体在170级时进行第1次经验模块重构,机体等级回到1级,当这个机体等级到达130级即达到顿悟条件,就会瞬间回到170级。具体情况建议您察看官方网站相...详情>>
答:线性链表分好几种,分为单链,双链等,它们的存储顺序也不一样. 线性表是顺序存储的,占顺序的存储空间详情>>
问:电脑安装了VB6.0,为什么打开方式里面没有VB程序选项,进安装好的VB里去关联...
答:打开方式最下面还有一个《选择程序》,点开后查VB的安装目录的EXE,找到后直接打开,下次就会在打开方式里查到了详情>>